Reindex Datagrid / Access to Index

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
ace16vitamine
Posts: 97
Joined: Fri Apr 13, 2018 1:53 pm

Reindex Datagrid / Access to Index

Post by ace16vitamine » Fri Sep 18, 2020 10:53 am

Dear all,

is there any chance to reindex my DataGrid without exporting/importing the Datas?

I ask because after I fill this DataGrid I am using

Code: Select all

   
   dispatch "SortDataByKey" to group "tabelle1" of card "main" with "mobile_sortieren", "numeric", "ascending", "false"
   dispatch "RefreshList" to group "tabelle1" of card "main" 
   
to sort the information with the item mobile_sortieren. Then I am able to click on a entry in my DataGrid and open the informations in another card. From there I want to "Swipe" forward / backward. But my problem is that the Index is now sorted (e.g. 5,2,4,3,1) and I have no Idea how to access the information for e.g. before/afterwards index 4 because I can not work with 4-1 or 4+1.

Q1: How can I reindex the DataGrid after the sorting
Q2: How can I read out the keys from the Index of a DataGrid (e.g. 5,2,4,3,1) , is there any command?

Thanks
Stefan

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7404
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Reindex Datagrid / Access to Index

Post by dunbarx » Sat Sep 19, 2020 6:54 pm

Hi.
Q1: How can I reindex the DataGrid after the sorting
I never do. I massage everything in either the dgText or the dgData and reload. Much more comfortable for me than to fool around with the data grid API.
Q2: How can I read out the keys from the Index of a DataGrid (e.g. 5,2,4,3,1) , is there any command?
The dgData is an array containing the entire contents of the DG. You can work directly in there, no?

Craig

Klaus
Posts: 12202
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Reindex Datagrid / Access to Index

Post by Klaus » Sun Sep 20, 2020 10:38 am

Hi Stefan,

can't you use LINE instead of INDEX?
With "dghiliteslines", "dgIndexOfLine", "dgDataOfLine", "the dgline of grp xyz" etc.?


Best

Klaus

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”