Reputation: 177
I have a grid (with MVC model), in which there are couple of columns, in which the value depends on other cells value. I used the columns renderer property, which worked well in the beginning. But if a columns value depends on another columns value, which was also rendered dynamically, then I cannot get the value of that cell with the record.get() for obvious reasons.
I shouldn't be just rendering a cells value, but I should actually set the value. What would be the correct way of doing this?
Thanks in advance!
Upvotes: 2
Views: 2025
Reputation: 48256
You should add methods to your model to figure out the value of the other cells.
Example, if you have interestRate
and loanPeriod
properties in your model, then you could add a method to your model such as getMonthlyPayment()
In your grid column renderer:
renderer: function(value, meta, record){
return record.getMonthlyPayment();
}
You don't need an actual model property to have a grid column with a renderer
.
Upvotes: 1