Page 1 of 1

Datagrid Hilitedrows

Posted: Thu Nov 05, 2015 5:18 pm
by gstone
Hi everybody,

I have hit a theoretical brick wall today and know a solution is out there!

I have a datagrid which is populated with data every morning. The user will then select multiple rows from the list and continue processing the item further.

However.. I have tried and failed at:

Deleting rows which are not hilited.

Passing the entire row(s) to a variable then deleting the datagrid data, last step to then restore the data back to the datagrid from the variable. (leaving only the hilited rows as data in datagrid)

Here is an example:
Deleting the data selected then restoring it..

Code: Select all

put the dgHilitedLines of group "DeliveryData"  into theLine
          set the dgData of group "DeliveryData" to empty
put theLine into group "DeliveryData" 
   
Any help would be great, also hope this is the correct thread to post.

Thanks

Re: Datagrid Hilitedrows

Posted: Fri Nov 06, 2015 1:16 pm
by MaxV
Use this code:

########CODE#######
put the dgIndexes of group "DeliveryData" into allIndexes # form is "1,2,3,4,.."
put the dgHilitedIndexes of group "DeliveryData" into rowToMantain
repeat for each item tItem in allIndexes
if tItem is not among the items of rowToMantain then
send ("deleteIndex " & tItem) to group "DeliveryData"
end if
end repeat
#####END OF CODE#####

and read here: http://livecode.wikia.com/wiki/Datagrid ... eteIndexes

Re: Datagrid Hilitedrows

Posted: Mon Nov 09, 2015 8:40 am
by gstone
Thank you, the code you supplied had resolved my problem. Also the link had helped e further progress! :)

Thanks again.