LiveCode Lessons
Topics
-
Data Grid Fundamentals 7
-
Working With Data Grids (Forms & Tables) 14
- How Do I Determine The Selected Line?
- How Do I Get Data Associated With a Row or Column?
- How Do I Add A Row Of Data To An Existing Data Grid?
- How Do I Update Data In a Row?
- How Do I Clear Data From a Data Grid?
- How Do I Add a mouseDown Event To The Data Grid Without Breaking It?
- How Can I Store An Option Menu Value When The User Makes a Selection?
- How Do I Refresh a Data Grid After Making Changes to a Template Through Script?
- How Do I Use A Template In Multiple Data Grids?
- How Can I See What The Data Grid's Internal Array Currently Looks Like?
- How Do I Get Aggregate Values for Columns?
- How Do I Determine If the Data Grid Has Focus?
- How Do I Export Data From A Data Grid?
- How Do I Work with Checkboxes in a Data Grid?
-
Working With Data Grid Tables 13
- How Do I Change Column Alignment?
- How Do I Sort By A Column?
- How Do I Resize Columns?
- How Do I Override the Default Behavior For Rendering Data to a Cell?
- How Do I Determine If a User Clicks In The Table Header?
- How Do I Display a Contextual Menu When the User Clicks on a Column Header?
- What If I Need to Work With htmlText, rtfText or unicodeText?
- How Do I Display Line Numbers in a Table?
- How Do I Customize Column Sorting?
- How Do I Disable Column Sorting?
- How Do I Perform An Action After the User Sorts a Data Grid?
- How Do I Align Decimals in a Column?
- How Can I Colorize Individual Lines in a Table?
-
Using The Built-In Field Editor 6
- How Do I Open a Table Cell For Editing?
- How Can The User Edit Field Content in a Data Grid Form?
- How Can I Edit The Text as UTF-8, UTF-16 or HTML?
- How Can I Select The Text in the Edit Field When It Opens?
- How Do I Save Changes The User Makes In An Editor Field To An External Data Source?
- How Can I Customize The Field Editor Behavior?
-
Building Standalones With The Data Grid 0
-
Useful Things To Know 1
-
API and Properties 3
Last Updated
Feb 22, 2018
Author: Maria Pantousi
Other Resources
Getting Started with LiveCode
- Get Up and Running with LiveCode
- Getting Started with LiveCode Development
LiveCode Lessons
- How To - Step-By-Step Guides To Tasks In LiveCode
- How To - LiveCode Server Tasks
- How To - LiveCode Mobile Tasks
- How To - LiveCode Sample Scripts
- How to - LiveCode Marketplace Products
- How to Purchase and License LiveCode
LiveCode Releases
- LiveCode 6.5
- LiveCode 6.7
- Summer School 2
- LiveCode 8
LiveCode Builder
- Creating Widgets
- Building, Sharing and Installing Extensions
Ben
How do I change the direction of the sort using a script?
Gilar Kadarsah
Is there any way to make collum sort permanent? it mean, we update dataGrid by script (not user click), sort still work automatically. Yes it is there is sort by script above, but after update we have to run that script again and again and it make the speed slower. Thanks
Matthias Rebbe
Adding the following empty handler
on SortDataGridColumn pColumn
end SortDataGridColumn
to the Datagrid script should do what you want.
Matthias Rebbe
@Ben.Brannen
There are several ways to do it.
You can use the property dgColumnSortDirection
set the dgColumnSortDirection["col1"] of group "Data Grid" to "ascending"
possible values are ascending or descending
or you could use the command SortDataByKey
dispatch "SortDataByKey" to group "DataGrid 1" with pArrayKey, pSortType, pDirection, pCaseSensitive
where
pArrayKey is the columname
pSortType can be numeric,text,international, datetime
pDirection can be ascending, descending
pCaseSensitive can be TRUE, FALSE
Gilar Kadarsah
@Matthias Rebbe
I put this on dataGrid Script did not works for me
on SortDataGridColumn pColumn
end SortDataGridColumn
Matthias Rebbe
Hm,
i just tried it here again. Without that handler i can click on the columns header to sort and sorting works. If i add the two lines to my Datagrid script , then clicking on the columns headers to sort does not work.
Gilar Kadarsah
@Matthias Rebbe
Yes it mean disable Sort.
What I want to do is Sort Permanent. event data grid updated with this script
http://lessons.livecode.com/m/datagrid/l/7315-how-do-i-update-data-in-a-row
Matthias Rebbe
It seems i´ve misunderstood your origin question, please excuse. I am sorry, but i have no answer then for you, but i am sure someone of the Livecode stuff will answer.
Gilar Kadarsah
Hi @Matthias Rebbe ...
i appreaciate your comment
Elanor Buchanan
Hi Gilar
You should be able to resort after adding update the content by using the SoryByColumn command e.g.
dispatch "SortByColumn" to group "DataGrid" with "name"
I hope that helps.
Kind regards
Elanor
Gilar Kadarsah
Hi @Elanor Buchanan
I have tried this
dispatch "SortByColumn" to group "DataGrid" with "name"
but it make data grid slow,
FYI: my apps get data feed and update about 80 line/second.
so i update about 80 times / second
it feel slow when i have to run sort script every time update