Hi,
I have debit/credit columns in my grid. And conventionally the debit credit columns work in such a way that if one is filled with a value the other one contains 0 and vice versa.
Is there a way I could achieve that in igGrid without writing my own javascript functions. If a user enters a value of 10 in debit column, the credit column automatically gets the 0 value & if he enters 10 in credit column the debit column of that row would be set to 0.
I am stuck on several features of igGrid and it would be too time consuming for me to test it on trial and error basis. If anyone has a short sample of this kind of grid, It would help me alot & save me alot of time. This debit credit column functionality is I think pretty common & hopefully some one would have a short sample of it. I would really appreiciate the help. Thanks in advance.
Hello Zep,
Thank you for contacting Infragistics Developer Support!
You can lock your cell to be read only using the editCellStarting and canceling the event based on some condition.
1 2 3 4 5
editCellStarting: function(evt, ui) { if ((ui.columnKey == 'debit' || ui.columnKey == 'credit') && ui.value == 0) { return false; } }
Please review the attached sample and let me know if I may be of any further assistance let me know.
Thanks Denis, Is there a way to get the reference to other columns while sitting in editCellStarting event or editRowStarting event. I want to allow the user to enter any new value in the current column but I want to update the value of its opposite column (debit or credit) equal to 0.
How can I get the reference to the whole row which is being added or edited. For example if row#1 is click for editing & the user set debit = 1234 then I want to set the credit of that same row to 0, & for doing that I want the reference to that same row without the knowledge of the rowId because this could also be done on AddnewRow. How can I get the whole row as an object while sitting inside these editCellStarting & addRowStarting events?
Hello,
I'm just following up to see if you need any further assistance with this issue. If so please let me know.
I have achieved what I was looking for using your suggestion with a little bit of tweaking. Thanks for your help.