dg-Reset Sort By Column / Sort By dg Index

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dickey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 118
Joined: Wed Apr 08, 2009 11:54 pm

dg-Reset Sort By Column / Sort By dg Index

Post by dickey » Mon Oct 05, 2009 12:16 pm

Hello All,

I am living in the world of the DataGrid at present. It's a nice place to be.

Background to the question.

Before any user interaction, a dg will display in the order of it's internal index dgIndex (from observation I believe this to be so).

If a user clicks in a column header in the datagrid it will toggle sort asc/desc which is the default behavior. All good.

Two questions, aiming to achieve the same result.

Q1: What is the syntax to programatically reset (remove - not replace) the current sort for the dg?

set the dgColumnSortType [ COLUMN ] of group "Data Grid" to "numeric" allows you to set it, but perhaps you can use similar code to remove/reset sorting as well.

Q2: How do you programatically ask the grid to sort by it's internal index, when a column is currently selected for sort?

Any assistance greatly appreciated.

Kind regards, Andrew

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Post by trevordevore » Mon Oct 05, 2009 3:44 pm

Hi Andrew,

Try this:

Code: Select all

set the dgProps["sort by column"] of group 1 to empty
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

dickey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 118
Joined: Wed Apr 08, 2009 11:54 pm

dg-Reset Sort By Column / Sort By dg Index

Post by dickey » Mon Oct 05, 2009 10:50 pm

Thanks Trevor,

Ha ha (I feel a little foolish now), seemed all too obvious when I saw the answer.

Works perfectly well.

In my opinion the DataGrid is a major triumph that may single-handedly bring many new customers to Revolution.

Trevor, still dreaming of a day when I can freeze a column as per our discussion back in mid April http://forums.runrev.com/phpBB2/viewtop ... highlight=. But constraint brings innovation and I have crafted a quasi headup display I place at the top of my grids to display data for the dgHilitedIndex (currently hilited record). When working extensively with data editing, analysing data it has saved me a great deal of scrolling particularly when you have more than 10-12 columns. Nothing special though it is really just a collection of fields that show a large or miniature view of data in columns that are important or not in view for the hilited record. I must say the learning curve for Rev and the Grid is a very well supported affair.

Kind regards - Andrew

Post Reply