Page 1 of 1

Problem after datagrid form sort

Posted: Fri Sep 06, 2013 5:07 pm
by Traxgeek
Further to my recent problems with DataGrid forms :

I've managed to sort my DataGrid by Key with a:
dispatch "sortDataByKey" to group "myDataGrid" with "myKey", "International", "Ascending/Descending", "False"

but... when I then click / select a specific item/row I'm parsed the data from the wrong dgIndex.
If I remove the sort then everything works just dandy... add the sort and my line/row selection goes to pot...

What I'm trying to do is pass all the relevant data on a specific item into a DataGrid but only displaying enough of it to enable the user to select the item they want to see. Clicking on the required line/row should (well, it does when I don't sort the data) open a group of items that displays the item in full... well, that's the idea but, like I say, I can't get it work after a sort...

Any ideas please ?

Re: Problem after datagrid form sort

Posted: Sat Sep 07, 2013 2:11 pm
by Klaus
Hi Trax,

what did you script "on mouseup" that does not work correctly after a sort?
Be sure to query the current dg INDEX and not LINE, which may of course change after a sort!

Best

Klaus

Re: Problem after datagrid form sort

Posted: Sat Sep 07, 2013 4:32 pm
by Traxgeek
Hi Klaus,

Before sorting (SortDataByKey), my MouseUp script works as expected. After a sort it fails.

My 'on MouseUp' script looks like :

on MouseUp
local sData

put the dgDataOfLine[the dgindex of me] of me into sData
Display_DetailedDGData sData --pass the complete data subset (for this DG row) to my detailed data display script...
end MouseUp

When I remark out the sort, populate the DG and select a line all works as expected...

Hope you can help.

Have a great weekend.

Re: Problem after datagrid form sort

Posted: Sat Sep 07, 2013 11:29 pm
by Klaus
AHA!

the DGLine <> the DGIndex! 8)

Code: Select all

on MouseUp
  local sData

   ## Use this:
   put the dgDataOfIndex[the dgindex of me] of me into sData

   ## OR:
   ## put the dgDataOfLine[the dgLine of me] of me into sData
   ## But mixing them will cause some headache!

   Display_DetailedDGData sData --pass the complete data subset (for this DG row) to my detailed data display script...
end MouseUp
The Index stays "fix" where LINE (the visibke representation of a record) may change e.g. after a sort!


Best

Klaus

Re: Problem after datagrid form sort

Posted: Sun Sep 08, 2013 10:40 pm
by Traxgeek
Ahhhhhhh.... thanks a million Klaus !
Must confess, hadn't noted the difference - have now (these datagrids; they're tricky critters !!
Brilliant - much appreciated.