PDA

View Full Version : Tricky problem for newbie - grid/custom renderer causing all fields to update



jwc
30 May 2011, 11:10 PM
HI,

I don't need a detailed example of how to fix this - just some conceptual help in understanding if there is an easy way to fix this.

I have a grid that renders lots of numbers - many columns are all zeros ("00.0")
I have a roweditor that is set up and working, when I update a field it posts the field key and new value, plus some authentication stuff to my php backend.

Then I got an idea: wouldn't this grid look better if all those 00.0's just showed as blank? So I wrote a simple renderer function that looks like this:


function renderNozeros(value){
return (value == 0) ? "" : value;
}

That looked beautiful! All the 00.0's were gone and my grid was easy to read. But it created a problem that I have been unable to figure out in the update process: now when I update a field, the roweditor marks all fields (updated or not) that use the renderer function as dirty (with the little red flag) and sends all fields to the server for update.

I know its not a huge issue - but its UGLY seeing all the red flags appear on untouched fields as the update is processed!

I am guessing the cause is that the field is different from its initial value (blank instead of 0.00) so its marked for update? Should I try to fix this in an afterEdit event or something?

Thanks!

jwc
31 May 2011, 1:53 AM
For anyone else that might have this problem I found a solution here

http://www.sencha.com/forum/showthread.php?89578-RowEditor-plugin-and-non-editable-rendered-fields