[Pier] TreeView is not sorted

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Pier] TreeView is not sorted

Damien Cassou-3
Hi,

PRTreeView display sub items using the order of the children dictionary.
A dictionary has no order, therefore items are shuffled. I would like to
have sub items in the order in which I added them or, better, having a
component to let me give my order.

What is the best solution ?

I thought of a 'priority' property for structures. This priority would
then be used to sort the elements.

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: [Pier] TreeView is not sorted

Lukas Renggli-2
> PRTreeView display sub items using the order of the children  
> dictionary.
> A dictionary has no order, therefore items are shuffled. I would  
> like to
> have sub items in the order in which I added them or, better, having a
> component to let me give my order.
>
> What is the best solution ?

Load the latest version of Pier, I fixed that yesterday :-)

> I thought of a 'priority' property for structures. This priority  
> would then be used to sort the elements.

The enhanced children visitor would allow to do exactly that. You  
just have to redefine the default sort-block in the default context  
used for new sessions.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: [Pier] TreeView is not sorted

Damien Cassou-3
Lukas Renggli wrote:

>> PRTreeView display sub items using the order of the children  
>> dictionary.
>> A dictionary has no order, therefore items are shuffled. I would  
>> like to
>> have sub items in the order in which I added them or, better, having a
>> component to let me give my order.
>>
>> What is the best solution ?
>
> Load the latest version of Pier, I fixed that yesterday :-)


What a synchronisation :-)


>> I thought of a 'priority' property for structures. This priority  
>> would then be used to sort the elements.
>
> The enhanced children visitor would allow to do exactly that. You  
> just have to redefine the default sort-block in the default context  
> used for new sessions.

Ok, but I need something to base the order on if I want to sort by
creation time for exemple. In this case, I would need to modify
ChildrenDecoration>>#add: to add an index, or Structure>>initialize to
add a timestamp property. What do you think ?

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: [Pier] TreeView is not sorted

Lukas Renggli-2
>>> I thought of a 'priority' property for structures. This priority
>>> would then be used to sort the elements.
>>
>> The enhanced children visitor would allow to do exactly that. You
>> just have to redefine the default sort-block in the default context
>> used for new sessions.
>
> Ok, but I need something to base the order on if I want to sort by
> creation time for exemple. In this case, I would need to modify
> ChildrenDecoration>>#add: to add an index, or Structure>>initialize to
> add a timestamp property. What do you think ?

There are other possibilities:

- Put the new value into a property and initialize it lazily.

- Use the hook method that is called on the class-side of all  
concrete decorations when a structure is added to initialize a  
property. You don't need the decoration in this case, just the hook.

Hope this helps,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: [Pier] TreeView is not sorted

Damien Cassou-3
Lukas Renggli wrote:

>>>> I thought of a 'priority' property for structures. This priority
>>>> would then be used to sort the elements.
>>> The enhanced children visitor would allow to do exactly that. You
>>> just have to redefine the default sort-block in the default context
>>> used for new sessions.
>> Ok, but I need something to base the order on if I want to sort by
>> creation time for exemple. In this case, I would need to modify
>> ChildrenDecoration>>#add: to add an index, or Structure>>initialize to
>> add a timestamp property. What do you think ?
>
> There are other possibilities:
>
> - Put the new value into a property and initialize it lazily.
>
> - Use the hook method that is called on the class-side of all  
> concrete decorations when a structure is added to initialize a  
> property. You don't need the decoration in this case, just the hook.

Thank you Lukas

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki