Datagrid Hilitedrows

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
gstone
Posts: 17
Joined: Wed Aug 19, 2015 4:19 pm
Location: United Kingdom
Contact:

Datagrid Hilitedrows

Post by gstone » Thu Nov 05, 2015 5:18 pm

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

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: Datagrid Hilitedrows

Post by MaxV » Fri Nov 06, 2015 1:16 pm

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
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

gstone
Posts: 17
Joined: Wed Aug 19, 2015 4:19 pm
Location: United Kingdom
Contact:

Re: Datagrid Hilitedrows

Post by gstone » Mon Nov 09, 2015 8:40 am

Thank you, the code you supplied had resolved my problem. Also the link had helped e further progress! :)

Thanks again.

Post Reply

Return to “Databases”