View Full Version : Is this an acceptable way of changing a grid cell based on if its selected or not?

18 Jul 2014, 12:33 PM
I have a grid view with the cells loaded from a store and its using a xtemplate.

Upon selecting a cell I would like the template to change so I can display a button on the selected cell.

This works but doesn't feel right.

In the listener for the cell select I just do record.data.isselected=true (isselected isn't a field in the model).

I then refresh the specific cell on the grid.

The template for the cell has a if statement for isselected.

Upon deselection I do "delete record.data['isselected']". And then refresh the cell.

It works fine. But is there a more proper way?

19 Jul 2014, 12:45 AM
Perhaps always render the HTML for both alternatives and just use CSS to show/hide the appropriate content?