That is one of the iterations I tried. The grid opens and closes without errors. But, the button text and icon doesn't change. I figured it was either because those properties were bound to RPG fields or because the button needs to be redrawn.
Most of the widgets work that way, they draw when their "field type" is changed, so changing it (even to the same value it was already set to) will cause it to re-draw.
So you can try that... but it could very well be that I'm wrong about something in the way this works in a CSS button. If setting the field type doesn't help, I may need to create a test case to try it out.
OK, I put that widget redraw code in there but the button text and icon still don't change. So, it must be the fact that those properties are bound to RPG fields which prevents them from being changed directly via applyProperty(). Anything else?
Hmmm... I set up a test case, and it works fine for me.
Please make sure you are using the button's "id" property on the applyProperty() call (not the bound field name). Also, it's case-sensitive, so be sure the upper/lower case matches exactly.
mpilo0 wrote:I've had the same problem on other properties I wanted to set in Javascript. The best way that i have found to do this is to simply add a hidden textbox/checkbox to your screen where you store the value giving the textbox/checkbox the same binding field as the property.
mpilo0, I tried your suggestion and that is not working, either. I created two hidden text boxes and bound their "value" property each to the same RPG fields as the button in question. Then I set their value instead the button properties and do the redraw just for good measure. No dice.
Scott Klement wrote:Hmmm... I set up a test case, and it works fine for me.
Please make sure you are using the button's "id" property on the applyProperty() call (not the bound field name). Also, it's case-sensitive, so be sure the upper/lower case matches exactly.
I did a copy-n-paste from the id field of the button into the JavaScript code for the onclick event of that same button. Still not working.
I found the problem... I put alerts in the code for the grid.expanded property and it is coming up "undefined" so that explains why the button text is not changing -- because the answer to the if-condition is always false.
Well, I ran it through Firebug to look at the properties on the grid and there isn't an exposed property that seems to fit the bill. There are several obfuscated property names with true/false values but, not knowing which one, I figured that is what you're going to tell me -- that the needed property is not exposed and would have to be done in a future release.
In the meantime, I created a workaround to capture the indicator coming from RPG in my screen's onload event: