Page 1 of 1

Database-Driven Subfile Cell Access

Posted: Wed Aug 18, 2010 3:49 pm
by RussCraig
Hi All,

How can I access a specific cell in a database-driven subfile? I can get the row that was clicked using the "onrowclick" property, but that only gives me the row number. Because this is a database-driven subfile, there are no subfile fields to reference. So I know which row was clicked, but I can't access any of the data stored in that row. Now I could be missing something obvious here (please correct me if I am), but it seems like there should be a way to reference the data in the row.

Is there anything available similar to this? HiddenBox is a hidden text box used to pass the value back to the program: (pseudo code)

Code: Select all

changeElementValue("HiddenBox", getObj("Grid1").grid.row(row).cell(3).value);
Also, is there any further/advanced documentation on the APIs? The documentation supplied so far is helpful, but descriptions on things such as the different element subfields (i.e.: grid.row, object.value, etc) would be extremely useful. If there is another way of obtaining this info, please let me know.

Thanks,
-RC

Re: Database-Driven Subfile Cell Access

Posted: Wed Aug 18, 2010 10:55 pm
by Alex
Try it as follows:

Code: Select all

changeElementValue("HiddenBox", getInnerText(getObj("Grid1").grid.cells[row][0]));
0 refers to the first column in this example.

We will be expanding our API docs to cover all grid properties, etc.

Re: Database-Driven Subfile Cell Access

Posted: Thu Aug 19, 2010 8:41 am
by RussCraig
Thanks Alex. That works great, but only for the first page of records, and only if I don't scroll. Say I have 25 records visible: as soon as I scroll a single record and click on row 26 (which is now visible row 25), I get the following error:
Message from webpage:
Onrowclick error: 'grid.cells[...].0' is null or not an object.
Also, say I scroll by 23 rows, this brings record 25 up to visible record 2. If I then click on row 2 it gives me the value from the ORIGINAL row 2, not the currently visible row 2. So it's as if it only stores values for the initial visible grid.

I used your exact syntax. Perhaps that way can only reference the visible rows in the grid, so if I have 25 rows visible, but actually click on row 100, it tries to pass 100 into your code when it's expecting a value 1-25. I could be completely wrong on that though. Is there a 'scroll offset' value that's stored anywhere that I could use to offset the clicked row so the value becomes the visible row?

Any ideas on the error? Thanks,
-RC

Re: Database-Driven Subfile Cell Access

Posted: Thu Aug 19, 2010 9:13 am
by RussCraig
Ok, after reviewing the release notes, I saw this for version 2.0.9:

•New grid.getCellValue(row, col) JavaScript API

Using that method it retrieves the proper cell value no matter where I've scrolled in the grid. This is exactly what I needed.

Thanks!
-RC