java script code for grid row height

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
grmarks
Profound User
Posts: 30
Joined: Thu Apr 29, 2010 9:32 pm
First Name: Glenn
Last Name: Marks
Company Name: Pacific Brands
Country: Australia
Contact:

java script code for grid row height

Post by grmarks »

What would the java script code be for a grid row height. That is on a mouse over event how would you increase the row height of the grid. eg objGet("Subfile1").??????????= 50
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: java script code for grid row height

Post by Alex »

The syntax to set the grid's row height with JavaScript is as follows:

getObj("Subfile1").grid.setProperty("row height", 25);

Explanation:
getObj() retrieves a reference to the browser native DOM element by the element's Id. Subfile elements will have a .grid property, which refers to the grid object that manages the behavior of the subfile. The grid object has a number of methods, one of which is .setProperty(), which allows you to set one of the many properties you see in the designer's Properties Window. The .setProperty() method takes 2 parameters: the name of the property and a value.
grmarks
Profound User
Posts: 30
Joined: Thu Apr 29, 2010 9:32 pm
First Name: Glenn
Last Name: Marks
Company Name: Pacific Brands
Country: Australia
Contact:

Re: java script code for grid row height

Post by grmarks »

Thanks for that.

using the above snippet of code here is some Java script code I used to get fold/unfold functionality on a grid (subfile) using the double click event.

if (! this.expanded)
{
this.expanded = 1;
getObj("SUBFILE1").grid.setProperty("row height",50)
}
else
{
this.expanded = 0;
getObj("SUBFILE1").grid.setProperty("row height",25)
};

note - the "if (! this.expanded)" works for both NULL variable and false value. The "this.expanded" variable is created when it is set to 1 on the first pass.

also on the "On Load" event I use this Java Script

getObj("SUBFILE1").grid.setProperty("row height",25)

The page was designed with "row height" of 50 and only 1/2 the number of rows. Then when finished the "number of rows" was doubled to occupy the same space when "row height" was halved (set to 25 on page load).

I found if I changed the "number of rows" property (when I changed the "row height" property) it stuffed up the grid by copying the first row to all the others when it was unexpanded and set back to the full number of rows at 1/2 height.

If I knew how to "get" the "row height" property I wouldn't need the "this.expanded" variable to control the toggle.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests