3.0 beta 2

cell template refresh

I have a cell template for setting the background color of a cell based on the contents of another cell in that row. I would like the color to change for that cell when the other cell is edited, and here I am stuck.

grid.defineCellProperty("class");
grid.setCellClass(cellClass);
grid.getCellTemplate().setStyle("background-color",function()
{
if (this.getCellProperty("class") == "critical")
{
return "#F95757";
}
});
function cellClass(i,j)
{ .... return newclass; }

In the onCellValidating function I call:

grid.getCellTemplate(1,row).refresh();

but the color does not change to correspond with the new entry. (It shows correctly when I refresh the whole page.)

Any ideas greatly appreciated.
beth
March 15,
grid.getCellTemplate(1,row).refresh();

This is the statement that does not seem to have any effect. Does anyone know why? I need to re-paint a cell based on a new grid entry.
beth
March 16,
did you try render()?
jLH
March 17,
Thanks, but I don't know what that is a method of ... ?
beth
March 17,
Have you tried this?
grid.getCellTemplate().setStyle("background",function()
instead of:
grid.getCellTemplate().setStyle("background-color",function()

March 18,
Thank you for that suggestion ... still same effect tho.

Have to page down and then page up to see the new color. :-(
beth
March 18,
Sorry for suggest to test and fail again, but...
and this one?
getCellTemplate(col,row).getContent('box').refresh();
March 18,
Thanks so much for another suggestion ... this does not refresh either, but I was very hopeful. :-) Is there any resolution? This is happening under IE 7 and IE 6.

Does anything work for anybody, in doing an immediate cell-repaint, called from the onCellValidating function?
beth
March 19,
I am still trying for a solution for this. I have a cell template for setting the background color of a cell:

grid.getCellTemplate().setStyle("background",function(){}

My problem is having the cell template refresh when cell contents change. It seems the only way this will happen is with a complete browser refresh. Without that, even when I re-load my data, setCellData to the new array, and refresh the grid, the cell color will not change unless I physically page down till the cell is out of view, and then page back up.

Along with the grid refresh, I've tried:

grid.getCellTemplate(1,row).getContent("box").refresh();

but it does not repaint the cell. Am I missing something? Any ideas very much appreciated.
beth
April 16,
Beth,
If I'm not too much mistaken, after reading a few (onCellValidating) posts like:
/datagrid.15407/confused-about-the-purpose-of.html
It seems that templates work the same as reverting values, and must be done using onCellValidated event instead ( just to prevent the editing part already finished).
But, as I am not totally sure ( never tried to refresh templates on validating) I would also give a try to some timeout or even refresh the full row (better than full grid/page).
HTH
Carlos
April 16,
Carlos, thank you so much for your help with this. It works! I use

grid.getRowTemplate(row).refresh();

in the onCellValidated event, and it does just what I want, and I don't even have to refresh the full grid. Refreshing the row rather than the cell was important, because the cell template was based on another value in that row, which changed as a result of the edit.

Thank you very VERY much. :-)
beth
April 18,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.