Author Topic: How to change cell background immediately  (Read 3569 times)

noctrona

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 82
    • View Profile
How to change cell background immediately
« on: September 10, 2014, 08:29:56 am »
Hi team,

I have a problem about change cell background.
I use "addClass" to add class for specified cell. And it works well without edit.
Now I met a problem. I will modify a cell value, and compare the old and new value then change the cell background. But when I test, the "addClass" can works well but only when I click another cell on gird.

I set double click to enter the edit model. And if I click other parts on page. The cell will quit edit model. But the color which I add only display when I click other cell not other parts on page.

Please have a look with my code:
Code: [Select]
if((ui.dataIndx == "myValue") && onInvoiceFastVal > parseFloat(ui.newVal)){
    pppGrid.pqGrid( "addClass", {rowIndx: ui.rowIndx, dataIndx: 'myValue', cls: 'cell-conDiff'} );
}
else if(onInvoiceFastVal <= parseFloat(ui.newVal)){
    if(pppGrid.pqGrid( "hasClass",{rowIndx: ui.rowIndx, dataIndx: 'myValue', cls: 'cell-conDiff'})){
        pppGrid.pqGrid( "removeClass", {rowIndx: ui.rowIndx, dataIndx: 'myValue', cls: 'cell-conDiff'});   
    }
}

I and try the "refreshCell", but still can't change background immediately.

So could you give me any suggestion for this?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: How to change cell background immediately
« Reply #1 on: September 10, 2014, 10:01:01 am »
Looks like the css rule for cell-conDiff has been overruled by the cell selection css.

you should write a full qualified rule e.g.,

div.pq-grid tr td.cell-conDiff{

}

noctrona

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 82
    • View Profile
Re: How to change cell background immediately
« Reply #2 on: September 10, 2014, 11:05:15 am »
Looks like the css rule for cell-conDiff has been overruled by the cell selection css.

you should write a full qualified rule e.g.,

div.pq-grid tr td.cell-conDiff{

}

Thanks for your explain. It works now!