I want to sort my listview entries
- ascending and descending
- also last entry should be always first entry on top
I am using colin tree listview extension, not the MIT listview component.
I cant find the reverse list command at Colintreelistview.aix
I want to sort my listview entries
ok, its working. But i have maintext and subtext values for each entry. Is there also a workaround?
You may do the same process for all.
The time to sort a table is before you have loaded it into a ListView's maintext and detailtext.
I get an error when using same code and having maintext and detailtext layout in listview.
How can i only sort maintext in listview ascending?
This block is used to sort a list that contains strings or numbers. Your list contains dictionaries and cannot be sorted this way.
Use this block like this:
I will try dictionary block for sorting ToDo list with key value pairs.
Dictionaries are sorted by key inherently.
Tables can be sorted any way you want.
These are my blocks for creating of dictionary, but i get error message ("Lookup in pairs: the list is not a well-formed list of pairs") when trying to sort by keys.
What is missing?
None of the blocks you posted include the list block "lookup in pairs".
Time to show us more.
Not "Titel" but "Text1". See my example, it has "Text1".
It is dangerous to depend on the accidentally exposed internals of a component like the ListView.
That component has been written and rewritten several times over its lifetime.
If you want your app to be future-proof, treat the ListView as a write-only component.
If you don't want to rely on the Text1 keys from the ListView as ABG mentions, then you need to sort the doctionary_list before you add its values ββto the ListView.
Patryk now it is working, great, i can sort the dictionary in both directions.
Are Text1 and Text2 fixed variables in Listview element for main and subtext?
ABG, i do not use the list block "lookup in pairs", don't know why the error message appeared.
My aim is to sort the listview of colins extension, as it is not possible i try to use Listview component with sorted lists internally and then copy the items to the listview extension.
Is there a better way to sort items in colins listview directly?
As of now, these are permanent keys for ListView and there are no plans to change them. I don't think there would be a reason to change them. But if you have concerns about this, like ABG, I mentioned in a previous post how to do it differently.
Sorry, I don't support extensions.
Tim, great thx, nothing is missing, everything works.
I thought i need a dictionary block for a list of pairs, but you dont need it.
I will need to check the precedes comparison function from Button2 and 3.
Is it also working with longer lists than 3? Wondering about the index 2.
index2 is the title in each element, e.g. Orange, Blue,Green
Yes, the blocks I showed will work for a list of any length