I wrote a javascript function that allows us to hide or disable widgets or tabs on any UI by placing the id name of the widget (and other key fields) in a table on the iSeries. This function is called in the onLoad() event for the record format. I use the applyProperty() function for the widgets and the getObj("tabname").hideTab() function for the tabs. This is working great.
The issue I cannot figure out is how can I use JavaScript to hide/disable widgets that are defined within a grid? My plan was to retrieve the number of rows in the grid and then loop through the rows and hide/disable the widget but I cannot find a function that will allow me to apply a property to a widget within a grid. I saw a method [getObj("Grid1").grid.getDataValue(1, "CUSTID")] that retrieves the data but nothing that allows me to set the properties.
Is there a function that will allow me to do this or some other way to do this?
Thanks,
-Rich
Setting properties on a widget within a grid
-
- Profound User
- Posts: 30
- Joined: Mon Jun 22, 2020 1:48 pm
- First Name: Rich
- Last Name: Dotson
- Company Name: MTD Products
- State / Province: Ohio
- Country: United States
- Contact:
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Setting properties on a widget within a grid
When Profound UI generates widgets in a grid, it adds a suffix to the "id" property for each row. For example, if you have an output field in a grid, and you set it's ID property to "myOutputField", then in row 1 of the grid, the ID will be "myOutputField.1", and in row 2 it will be "myOutputField.2", etc.
You can use those IDs with the applyProperty() function.
or perhaps
There is a caveat to this, however: For performance reasons, the widgets in a grid are not created until the user pages the row onto the screen. Therefore, if you tried to loop through all rows, and some have never been displayed to the user, some of the widgets may not exist, yet.
You can use those IDs with the applyProperty() function.
Code: Select all
applyProperty("myOutputField.2", "visibility", "hidden");
Code: Select all
for (var i=1; i=<numberOfRows; i++) {
applyProperty("myOutputField." + i, "visibility", "hidden");
}
Who is online
Users browsing this forum: No registered users and 3 guests