Page 1 of 1

Grid Element Properties

Posted: Thu Jan 14, 2021 9:16 am
by James-S
I would like to set the error tooltip of specific elements on a grid row. The pui.errorTip takes an object id for it's first parameter. Is there a way to get a specific row element's id to use in this API?

It feels like pui.errorTip has extended applyProperty. It uses the same object id parameter. I feel if I know how to reference a specific element on a row, I will get the direct access to each grid row element.

Thanks!

Re: Grid Element Properties

Posted: Fri Jan 15, 2021 12:51 pm
by Scott Klement
Elements in a grid have an id that is suffixed by the row number. For example, if you add a textbox with id=Textbox1, then it will be rendered with row 1 as Textbox1.1, row 2 as Textbox1.2, etc.

You should be able to use that id (with the dot row number) as the parameter to pui.errorTip.

Re: Grid Element Properties

Posted: Fri Jan 15, 2021 2:32 pm
by James-S
Gotcha.

To expand further on the dot number qualification.

The first parameter to errorTip is the object id. I am passing the row number from the Rich Display down to the javascript function. Being the parameter is a string, does that mean I can create a variable and pass that as the object id?


Code: Select all


var gridElementID = "TextBox' + '.' + row;   // TextBox.1
 
pui.errorTip(gridElementID, "This value is required.");
 

Re: Grid Element Properties

Posted: Fri Jan 15, 2021 3:11 pm
by Scott Klement
In my example, the id was TextBox1 (not just "TextBox"). And you've switched quote types in the middle of your code, which is a syntax error. But, yeah, the concept is solid.

Code: Select all

var gridElementID = "TextBox1." + row;   // TextBox1.1
 
pui.errorTip(gridElementID, "This value is required.");

Re: Grid Element Properties

Posted: Fri Jan 15, 2021 3:23 pm
by James-S
Good catch on the quotes. I catch myself doing that too often while making a further transition to javascript. Just need to build good habits, ya know?

As always, thanks for your help. Some of us old RPG'ers are trying to push forward. :D