Listview selection index

208 views
Skip to first unread message

Sankari

unread,
Aug 5, 2015, 11:10:58 PM8/5/15
to MIT App Inventor Forum
Hi

I have a listview with 'Show FilterBar' on.


On selecting an item, the selected index is stored in a text box (TB1).

When I type some text in the 'Search List' , my listview gets filtered based on  the search. Up to this it is ok. Let us say 2 items are displayed based on the search.

When I select the first item, TB1 displays 1 and on selecting the second displays 2.  Whereas, these two entries have different index in the original list.( 8 and 15)

I want to get the original selectedindex even after the search.


Pl help









Abraham Getzler

unread,
Aug 6, 2015, 1:25:40 PM8/6/15
to MIT App Inventor Forum
The prefilter options in the ListView are problematic, as you've discovered.

I suggest writing a service return procedure to return a pre-filtered copy
of your desired subset, with the original row indices appended to each row.

Feed the result of the pre-filtering into the ListView.
If you don't want to show extra columns, use a separate return procedure
to return just your desired column(s).

See this doc for some sample pe-filter routines
(the added original index idea isn't there yet.) ...

ABG

Taifun

unread,
Aug 6, 2015, 7:00:40 PM8/6/15
to MIT App Inventor Forum
this is an old issue, which has been discussed here https://groups.google.com/forum/#!msg/programming-with-app-inventor/v483nNLN51M/9cllEc25c1IJ
the Selection Index should not be used together with the FilterBar

in case you are interested, I can offer this alternative listview including a working search filter https://puravidaapps.com/listview.php

Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

Reply all
Reply to author
Forward
0 new messages