Page 1 of 1

DataGrid Table Column Reordering

Posted: Sat Dec 21, 2013 1:53 am
by Gage
Hello,

I just completed a DataGrid Table, and noticed that by default, you can click the column headers and reorganize the data by alphabetical (or reverse-alphabetical) order. I placed the order in the dgData in a specific order, and do not want it to be sorted any other way.

Two questions:
1. How can I correct the DG to NOT sort the information I have in it, so that when I refresh it, the data displays as it should according to my loading handler? (I have scripted a bunch of the column behaviors, so I am hoping I don't have to totally delete this DG and make a new one)

2. How can I make it so clicking the column header does nothing, instead of sorting the dgData?

Thank you in advance for any help on this... hope you are having a wonderful winter so far!
Phil E.

Re: DataGrid Table Column Reordering

Posted: Sat Dec 21, 2013 7:28 am
by Simon
Hi Phil,
OK since no one else has answered this yet I'll give you a workaround...
Export snapshot of the DG, do a little cropping to get only the header then import the image and place it over the top of the DG. :D

This only works if the DG is non-resizable.

Simon

Re: DataGrid Table Column Reordering

Posted: Sat Dec 21, 2013 11:35 am
by bangkok
The easiest way :

in the DG script, put :

Code: Select all

on SortDataGridColumn pColumn
    --pass SortDataGridColumn
end SortDataGridColumn
That's all.
;-)

Re: DataGrid Table Column Reordering

Posted: Sat Dec 21, 2013 11:42 am
by Simon

Code: Select all

on SortDataGridColumn pColumn
Way better!

Re: DataGrid Table Column Reordering

Posted: Sat Dec 21, 2013 6:12 pm
by Gage
Simon,

Very creative first solution! I should think like that more...


Bangkok,

I think I will go with you on that one! That's exactly what I needed.


Thank you both!
Phil E.

Re: DataGrid Table Column Reordering

Posted: Sat Dec 21, 2013 6:22 pm
by Gage
To help anyone else who is having similar issues, I realized that this topic is covered in the Tutorials in the Developer section of LiveCode.com, so I thought I would post the link to make the background information available, also.

http://lessons.runrev.com/s/lessons/m/d ... mn-sorting

Cheers!
Phil E.