More datagrid help needed!
Posted: Fri Nov 16, 2012 9:03 am
I'm having one of those "you can't teach old dogs new tricks" days.
Despite having gone through (which means I haven't read every line) the 230 page Livecode_Data_Grid.pdf helper, I'm still utterly confused.
Okay, with Klaus' help, I have a working datagrid which loads quickly and looks pretty, but I need to customize it.
I'm hoping someone will be kind enough to explain to me, using simple words, the right way to do the following...
My datagrid is for info only. I don't want users to be able to tap the headers to change sort order. I found a forum message that said:
"The correct way to really lock the column header is to add this handler in the datagrid group:"
Fine, but what/where is a "datagrid group"? What do I do with this tiny piece of code?
And now for something more complicated:
I'm reading data from a text file, building an array with the data I want in the grid, and then throwing the array to the datagrid with the set the dgData command. This, I believe is the normal way to do things.
In the text file, there are fields which are not transferred to the array/datagrid, but these fields I need to affect the formatting.
For instance, if a field in the file contains "A" I want to display some other field in the same line (which does go into the array) in red. Or set the background to some color, or maybe the whole line.
But by the time I've finished building the array I no longer have the data that determines the color. Not that I can find the way to set the color of a datagrid cell anyways!
So maybe I should start with a simpler question:
If, in column 2 of my datagrid, I have data which says "START" or "END" how do I color the STARTs in green and the ENDs in red?
Maybe I should understand that first!
Many thanks for teaching the old dog...
--paul
Despite having gone through (which means I haven't read every line) the 230 page Livecode_Data_Grid.pdf helper, I'm still utterly confused.
Okay, with Klaus' help, I have a working datagrid which loads quickly and looks pretty, but I need to customize it.
I'm hoping someone will be kind enough to explain to me, using simple words, the right way to do the following...
My datagrid is for info only. I don't want users to be able to tap the headers to change sort order. I found a forum message that said:
"The correct way to really lock the column header is to add this handler in the datagrid group:"
Code: Select all
on SortDataGridColumn pColumn
## Remain this handler empty for disabling the sort capability of a datagrid
end SortDataGridColumn
And now for something more complicated:
I'm reading data from a text file, building an array with the data I want in the grid, and then throwing the array to the datagrid with the set the dgData command. This, I believe is the normal way to do things.
In the text file, there are fields which are not transferred to the array/datagrid, but these fields I need to affect the formatting.
For instance, if a field in the file contains "A" I want to display some other field in the same line (which does go into the array) in red. Or set the background to some color, or maybe the whole line.
But by the time I've finished building the array I no longer have the data that determines the color. Not that I can find the way to set the color of a datagrid cell anyways!
So maybe I should start with a simpler question:
If, in column 2 of my datagrid, I have data which says "START" or "END" how do I color the STARTs in green and the ENDs in red?
Maybe I should understand that first!
Many thanks for teaching the old dog...
--paul