Page 1 of 1

DataGrid

Posted: Thu Jul 31, 2014 5:23 am
by arunmettle
I am trying to compare cells in in each columns and its for each line. For eg Column A has Stock quantity and Column B has the Stock Consumed. So if line 1 in column A is less than Column B, then set the color of the line of a Datagrid tables or just a cell in to red.

And another question is I have loaded this data from CSV but to convert the load data in to array backend to compare the values is this can be possible too. :?


Please guide me :roll:

Re: DataGrid

Posted: Thu Jul 31, 2014 2:09 pm
by dunbarx
Hi.

Have you been through the dataGrid manual? Especially starting on page 69? Datagrids require practice to use. They are terrific, but have their own "language" and behavior.

You can always extract the data using either the "dgText" of the group, and manipulate in the clear. In some ways this is simpler, since the data comes out as tab and return delimited text. There is little penalty for doing that.

Write back if you get stuck.

Craig Newman

Re: DataGrid

Posted: Fri Aug 01, 2014 1:29 am
by arunmettle
Thanks drunbarx;

I have managed to get the values of individual cells using dgIndexOfLine and dgDataOfLine properties.

But Now I am bit stuck to just change the color of a particular cell in a datagrid. Is there a way I can do it. For eg, if I have a condition to compare cells in the data grid, if true I need the particular cell to color 1 and Vice versa.

Please guide me :shock:

Re: DataGrid

Posted: Fri Aug 01, 2014 1:43 am
by Simon
Both Craig and I worked on a similar question
http://forums.livecode.com/viewtopic.php?f=8&t=20455
Bangkok got the answer.

Simon

Re: DataGrid

Posted: Fri Aug 01, 2014 2:32 am
by sritcp

Re: DataGrid

Posted: Fri Aug 01, 2014 2:36 am
by arunmettle
Thanks Simon.

But I would like to do something in the mouse up event of a button not in the row behavior and this where it haunts me more.
Is there anyway where we could get the dgprop for a individual cell and set the background color? :?: :!:

Re: DataGrid

Posted: Sat Aug 02, 2014 3:38 am
by arunmettle
Thanks Sritcp;

It was really helpful but how to set the condition if the values of the condition is from another column.

Thanks

Re: DataGrid

Posted: Sat Aug 02, 2014 2:18 pm
by sritcp
arunmettle wrote:....how to set the condition if the values of the condition is from another column.
Please read about dgIndex and dgDataOfIndex.
dgIndex will identify the row.
dgDataOfIndex will return the row contents as an array (where the array keys are the column names).
Once you have this, you can construct your condition based on any column(s) you want.

Regards,
Sri.