ListviewColumn Sortable="0"
-
- Posts: 475
- Joined: Fri May 15, 2015 5:15 pm
- Location: Waterville, Minnesota USA
ListviewColumn Sortable="0"
When I looked at the documentation for the sortable attribute, there appears to be no way to switch which column is sorted. Also, it's listed as being a number!? What values go to which behavior? Currently setting sortable to 0 in column 3 sorts by the first column. Sorting by any other positive value is stuck on the column it is selected in (column 3 in this case). Is there any way I can change the default column to sort, preferably by clicking the column title?
I'm on registered MorphOS using FlowStudio.
- airsoftsoftwair
- Posts: 5443
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: ListviewColumn Sortable="0"
Yes, that's clearly a typo. Type should be boolean instead. I'll fix that.SamuraiCrow wrote: ↑Mon Nov 16, 2020 2:29 am When I looked at the documentation for the sortable attribute, there appears to be no way to switch which column is sorted. Also, it's listed as being a number!?
Clicking the column title to sort might not work on all platforms but it should be possible to manually change the sorting column by setting Listviewcolumn.Sortable appropriately. Have you tried that?What values go to which behavior? Currently setting sortable to 0 in column 3 sorts by the first column. Sorting by any other positive value is stuck on the column it is selected in (column 3 in this case). Is there any way I can change the default column to sort, preferably by clicking the column title?
-
- Posts: 475
- Joined: Fri May 15, 2015 5:15 pm
- Location: Waterville, Minnesota USA
Re: ListviewColumn Sortable="0"
Thanks for fixing the docs. I suppose I could give each column an id field and clear the original field, set the new one and sort the listview again.airsoftsoftwair wrote: ↑Fri Nov 20, 2020 10:48 pm Yes, that's clearly a typo. Type should be boolean instead. I'll fix that.
Clicking the column title to sort might not work on all platforms but it should be possible to manually change the sorting column by setting Listviewcolumn.Sortable appropriately. Have you tried that?
I'm on registered MorphOS using FlowStudio.
Re: ListviewColumn Sortable="0"
Did you manage to make a way to change the sortable column?
If so, could you post an example of how to do it. I am currently using the Dialogs example as a base for a program, so an example based on that would be great.
If so, could you post an example of how to do it. I am currently using the Dialogs example as a base for a program, so an example based on that would be great.
-
- Posts: 475
- Joined: Fri May 15, 2015 5:15 pm
- Location: Waterville, Minnesota USA
Re: ListviewColumn Sortable="0"
I didn't try yet. I kept running into various bugs in RapaGUI and have been hoping the new release version 2.0 would be out soon.
I'm on registered MorphOS using FlowStudio.
Re: ListviewColumn Sortable="0"
Thanks for the reply. Lets see then, one can hope that 2.0 have a solution for having muliple columns sortable.
- airsoftsoftwair
- Posts: 5443
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: ListviewColumn Sortable="0"
It sure will. It's next on the agenda.SamuraiCrow wrote: ↑Tue Apr 13, 2021 4:23 am I didn't try yet. I kept running into various bugs in RapaGUI and have been hoping the new release version 2.0 would be out soon.
Re: ListviewColumn Sortable="0"
Hi,
I too am wondering about changing the sorting column when clicking on the column title.
For whatever reason, I cannot work out how to use Listview.column.Sortable.
Any examples would be greatly appreciated.
Dave
I too am wondering about changing the sorting column when clicking on the column title.
For whatever reason, I cannot work out how to use Listview.column.Sortable.
Any examples would be greatly appreciated.
Dave
Re: ListviewColumn Sortable="0"
I did some try/error on this.
I found that there is no Event called when the column titles are clicked.
The "ClickColumn" attribute is only triggered when clicking at one of the items in the listview.
Is this a bug?
I made a log of the (msg) passed to EventFunc
Here is what happens when clicking in the listview at item number 6 down in the list, at column number 5
As you see by the timestamp, these two events happens at the same time.
But I still struggle to find the command that will set the cloumn as sortable. The lack of examples sometimes makes RapaGUI into a guessing game for for non-experts.
I found that there is no Event called when the column titles are clicked.
The "ClickColumn" attribute is only triggered when clicking at one of the items in the listview.
Is this a bug?
I made a log of the (msg) passed to EventFunc
Here is what happens when clicking in the listview at item number 6 down in the list, at column number 5
As you see by the timestamp, these two events happens at the same time.
Code: Select all
{
"action": "RapaGUI",
"triggervalue": 4,
"id": "lv",
"class": "Listview",
"attribute": "ClickColumn",
"timestamp": 191.52494049072266
},
{
"action": "RapaGUI",
"triggervalue": 5,
"id": "lv",
"class": "Listview",
"attribute": "Active",
"timestamp": 191.52494049072266
}
Re: ListviewColumn Sortable="0"
Figured it out eventually.
I am now able to change the sorting column to any column I want. But note that you need to click somewhere in the list, at a column in a not-active entry to change the sorting column.
First give all the columns an id in the xml file so that there is an unique moai object to call for each column you want to be able to set sortable.
example:
Then in the evenfunc
I have two listviews in my program, thats why the extra swicth to determine which listview that was clicked. If there is only one listview I guess the swicth msg.id part can be skipped.
I am now able to change the sorting column to any column I want. But note that you need to click somewhere in the list, at a column in a not-active entry to change the sorting column.
First give all the columns an id in the xml file so that there is an unique moai object to call for each column you want to be able to set sortable.
example:
Code: Select all
<listview id="lv" notify="active">
<column id="lv1col0" title="Lastname"/>
<column id="lv1col1" title="Firstname" editable="true" />
<column id="lv1col2" title="Phone" />
</listview>
Code: Select all
Function p_EventFunc(msg)
Switch msg.action
Case "RapaGUI":
Switch msg.attribute
Case "ClickColumn"
Switch msg.id
Case "lv"
If msg.triggervalue=0 Then moai.Set("lv1col0", "sortable", True)
If msg.triggervalue=1 Then moai.Set("lv1col1", "sortable", True)
If msg.triggervalue=2 Then moai.Set("lv1col2", "sortable", True)
Case "lv2"
If msg.triggervalue=0 Then moai.Set("lv2col0", "sortable", True)
If msg.triggervalue=1 Then moai.Set("lv2col1", "sortable", True)
If msg.triggervalue=2 Then moai.Set("lv2col2", "sortable", True)
EndSwitch
EndSwitch
EndSwitch
EndFunction