Page 1 of 1

ListView sorting on android

Posted: Tue May 25, 2021 9:44 am
by amyren
How to use sorting listviews on Android?
Nothing happens when clicking the sortable column title in my program.
I also tried the small example below as an applet with Hollywood Player on android.

Code: Select all

@REQUIRE "RapaGUI"
moai.CreateApp([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application>
   <window title="Test program">
	<vgroup>
				<listview id="lv" notify="active">
					<column title="Last name" editable="true" sortable="true"/>
					<column title="First name" editable="true"/>
				</listview>
	</vgroup>
	</window>
</application>
]])

moai.DoMethod("lv", "insert", "bottom", "Peterson", "Bob")
moai.DoMethod("lv", "insert", "bottom", "Johnson", "Yusef")

Repeat
	WaitEvent
Forever

Re: ListView sorting on android

Posted: Tue May 25, 2021 8:38 pm
by lazi
You are missed to call the method:
moai.DoMethod("lv","sort")

Re: ListView sorting on android

Posted: Wed May 26, 2021 2:46 pm
by amyren
Your suggestion will perform the sorting automaticly.

My example will set the sortable column and the sorting will happen when the user is clicking in the column title area.
Then you can toggle ascending/descending sorting as well.
This works on windows, but not on Android.

Re: ListView sorting on android

Posted: Fri Jun 25, 2021 9:17 pm
by airsoftsoftwair
amyren wrote: Wed May 26, 2021 2:46 pm This works on windows, but not on Android.
Right, fixed now on Android.