Page 2 of 2

Re: Help changeing button attribute

Posted: Mon Oct 03, 2016 3:02 pm
by Scott Klement
Worked fine for me. I tried it with both pui.set() and grid.setDataValue(), both worked perfectly.

Here's my current code:

Code: Select all

var newColor = "gainsboro";
var checkVal = "0";

if ( this.style.backgroundColor == "gainsboro" ) {
  newColor = "green";
  checkVal = "1";
}

// pui.set("CID." + row, checkVal);
getObj("GridC").grid.setDataValue(row, "CID", checkVal);
applyProperty(this, "background color", newColor) ;
applyProperty(this, "field type", "button"); 
Maybe you haven't set the properties on your checkbox properly? (That wouldn't explain why a textbox didn't work, though...) but here are the properties that I'm using:
BedzCheckbox.png
BedzCheckbox.png (10.02 KiB) Viewed 1711 times
And here's the binding for the "value" property:
BedzBinding.png
BedzBinding.png (14.53 KiB) Viewed 1711 times

Re: Help changeing button attribute

Posted: Mon Oct 03, 2016 3:42 pm
by ppbedz
Scott, Visually, the js works correct. The grid looks like I want it to look. When I click a button in the grid, the corresponding text box (or check box) contains "1" or "0". However, when control returns back to the rpg to read thru the sfl, the text box does NOT contain the value I see on the screen. I have run the program in debug. If the grid button is green (text box = "1") and I click the button, the button turns gainsboro (text box value = "0"). When the rpg chains to that record, debug shows the text box value as "1" when it should have been changed to "0". Patti

Re: Help changeing button attribute

Posted: Mon Oct 03, 2016 4:07 pm
by ppbedz
Scott,

I actually added some dummy "readc" logic to my rpg pgm and it did not find any grid row as "changed". I am guessing that even though I can see values, the js isn't changing the actual data the program reads? Is there a way to accomplish this, or do I have to find a different way to do what I am trying to do?

Thank you,
Patti

Re: Help changeing button attribute

Posted: Mon Oct 03, 2016 4:27 pm
by Scott Klement
As I said before, it is working fine for me. Yes, I checked the values in my RPG program. Yes, it is returning the correct values, both when I click the button once and it turns the value on, and when I click it twice and turn the value back off.

I don't know why it's not working for you.

Re: Help changeing button attribute

Posted: Mon Oct 03, 2016 4:42 pm
by Scott Klement
If it helps, here is the RPG and DDS that I have been testing with.

Re: Help changeing button attribute

Posted: Tue Oct 04, 2016 7:58 am
by ppbedz
Thank you, Scott. Your code works on our machine. I am going to delete my grid and start from scratch. Thanks for your time!
Patti

Re: Help changeing button attribute

Posted: Tue Oct 04, 2016 11:18 am
by ppbedz
Mystery Solved! I took your screen code and moved to my screen and little by little started to modify until it stopped working. The culprit turned out to be the "bypass validation" property. I have a small red X button in the corner of the window that contains the grid. The red X is the way the user exits the window. It was copied from another program. The bypass validation property on the button was set to "true". Once I removed the property, everything worked fine! Scott, Thank you for your time and patience in helping me work through this. - Patti