innov8cs
09-29-2007, 01:01 PM
I've got a need where two fields in a grid are supposed to be updatable, but it's a case of either/or. The idea literally is it's a Debit amount and a Credit amount on the screen (accounting app) but the rules say you should be able to update either one or the other field - not both.
Now I've tried to put a onvalue event attached to the <gridtext> but for some reason that doesn't seem to fire other than at initialization of the grid before the dataset has data. That means it does fire a single time - when there is only a single row in the grid, and when that row has undefined data in it. So that's the reason for believing it's firing on init.
So my first thought was to make a <gridcolumn> instead because I seem to remember the <gridtext> is a bit odd in that the text component inside the <gridtext> doesn't respond the same way to events. So that did seem to fire the onvalue event more often, but still not at the right times - it fired once at grid init just like the onvalue of gridtext did. But then if there were 4 rows, if fired 3 times only for the new rows, not the initial row create at time of init.
So I'm looking for guidance on the best way to do the following -
Assume you have two <gridtext> - it's important to try to keep to gridtext because I have a bunch of other things I want to do like control its sorting, it's editability, and some other things. Out of the two columns, only one is supposed to be updated to have a non-zero number in it. If column A is zero and column B is zero is the only case where both of the gridtext are set to be editable.
Is the best way to try to catch an event when the data is changed and then say either "OK, the other field is zero so I will allow this" or "Sorry, the other field is not zero, zero it out first before trying to enter an amount here"?
Or as an alternative, should I try to enable.disable the individual cells right from the start? I know I can do that for the entire column, but is that realistic to do on a cell by cell basis of the grid?
What's the best way to do either? If it's an event on the data after changed, which event - it doesn't seem like onvalue is going to work at least on a
gridtext? Do I change away from a gridtext, and what then? If I can
enable/disable initially, what event to use there? Or maybe to define
the enable/disable based on a $path{} value? If so, any ideas about what value to choose?
Any help greatly appreciated.
Thanks.
lps 4.0.3 at the moment, going to 4.0.5 when I get a chance to test. Generally swf platform although DHTML is under testing. Any number of browsers.
Now I've tried to put a onvalue event attached to the <gridtext> but for some reason that doesn't seem to fire other than at initialization of the grid before the dataset has data. That means it does fire a single time - when there is only a single row in the grid, and when that row has undefined data in it. So that's the reason for believing it's firing on init.
So my first thought was to make a <gridcolumn> instead because I seem to remember the <gridtext> is a bit odd in that the text component inside the <gridtext> doesn't respond the same way to events. So that did seem to fire the onvalue event more often, but still not at the right times - it fired once at grid init just like the onvalue of gridtext did. But then if there were 4 rows, if fired 3 times only for the new rows, not the initial row create at time of init.
So I'm looking for guidance on the best way to do the following -
Assume you have two <gridtext> - it's important to try to keep to gridtext because I have a bunch of other things I want to do like control its sorting, it's editability, and some other things. Out of the two columns, only one is supposed to be updated to have a non-zero number in it. If column A is zero and column B is zero is the only case where both of the gridtext are set to be editable.
Is the best way to try to catch an event when the data is changed and then say either "OK, the other field is zero so I will allow this" or "Sorry, the other field is not zero, zero it out first before trying to enter an amount here"?
Or as an alternative, should I try to enable.disable the individual cells right from the start? I know I can do that for the entire column, but is that realistic to do on a cell by cell basis of the grid?
What's the best way to do either? If it's an event on the data after changed, which event - it doesn't seem like onvalue is going to work at least on a
gridtext? Do I change away from a gridtext, and what then? If I can
enable/disable initially, what event to use there? Or maybe to define
the enable/disable based on a $path{} value? If so, any ideas about what value to choose?
Any help greatly appreciated.
Thanks.
lps 4.0.3 at the moment, going to 4.0.5 when I get a chance to test. Generally swf platform although DHTML is under testing. Any number of browsers.