Database-Driven Subfile Cell Access

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
RussCraig
Profound User
Posts: 62
Joined: Wed May 05, 2010 10:13 am
First Name: Russell
Last Name: Craig
Company Name: Applied Business Services
Phone: 252-482-7666
Address 1: 617 Soundside Rd
City: Edenton
State / Province: North Carolina
Zip / Postal Code: 27932
Country: United States
Location: Edenton, NC
Contact:

Database-Driven Subfile Cell Access

Post 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
There are 10 types of people in this world: Those who understand binary and those who don't.
User avatar
Alex
Profound Logic Staff Member
Posts: 233
Joined: Fri Jan 04, 2008 12:10 pm
First Name: Alex
Last Name: Roytman
Company Name: Profound Logic Software
Contact:

Re: Database-Driven Subfile Cell Access

Post 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.
RussCraig
Profound User
Posts: 62
Joined: Wed May 05, 2010 10:13 am
First Name: Russell
Last Name: Craig
Company Name: Applied Business Services
Phone: 252-482-7666
Address 1: 617 Soundside Rd
City: Edenton
State / Province: North Carolina
Zip / Postal Code: 27932
Country: United States
Location: Edenton, NC
Contact:

Re: Database-Driven Subfile Cell Access

Post 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
There are 10 types of people in this world: Those who understand binary and those who don't.
RussCraig
Profound User
Posts: 62
Joined: Wed May 05, 2010 10:13 am
First Name: Russell
Last Name: Craig
Company Name: Applied Business Services
Phone: 252-482-7666
Address 1: 617 Soundside Rd
City: Edenton
State / Province: North Carolina
Zip / Postal Code: 27932
Country: United States
Location: Edenton, NC
Contact:

Re: Database-Driven Subfile Cell Access

Post 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
There are 10 types of people in this world: Those who understand binary and those who don't.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests