DataGrid

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
arunmettle
Posts: 6
Joined: Thu Jul 31, 2014 5:06 am

DataGrid

Post by arunmettle » Thu Jul 31, 2014 5:23 am

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:

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: DataGrid

Post by dunbarx » Thu Jul 31, 2014 2:09 pm

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

arunmettle
Posts: 6
Joined: Thu Jul 31, 2014 5:06 am

Re: DataGrid

Post by arunmettle » Fri Aug 01, 2014 1:29 am

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:

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: DataGrid

Post by Simon » Fri Aug 01, 2014 1:43 am

Both Craig and I worked on a similar question
http://forums.livecode.com/viewtopic.php?f=8&t=20455
Bangkok got the answer.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

Re: DataGrid

Post by sritcp » Fri Aug 01, 2014 2:32 am


arunmettle
Posts: 6
Joined: Thu Jul 31, 2014 5:06 am

Re: DataGrid

Post by arunmettle » Fri Aug 01, 2014 2:36 am

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? :?: :!:

arunmettle
Posts: 6
Joined: Thu Jul 31, 2014 5:06 am

Re: DataGrid

Post by arunmettle » Sat Aug 02, 2014 3:38 am

Thanks Sritcp;

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

Thanks

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

Re: DataGrid

Post by sritcp » Sat Aug 02, 2014 2:18 pm

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.

Post Reply