Page 1 of 1
java script code for grid row height
Posted: Tue Jun 22, 2010 10:21 pm
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
Re: java script code for grid row height
Posted: Tue Jul 06, 2010 9:49 pm
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.
Re: java script code for grid row height
Posted: Tue Jul 13, 2010 12:19 am
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.