EasyUI Forum

General Category => General Discussion => Topic started by: acreonte82 on May 27, 2020, 10:56:41 AM



Title: Datagrid => rowstyle after user event [SOLVED]
Post by: acreonte82 on May 27, 2020, 10:56:41 AM
Hello to all,
I've a new problem and the situation is this: after user send a special event , i want the row of the datagrid change backgroud color.
If I use the rowstyler function the datagrid reload the data .
So how i can solve this problem? Some one can help me?


Thanks


Title: Re: Datagrid => rowstyle after user event
Post by: jarry on May 30, 2020, 06:40:46 AM
Please define the 'rowStyler' and then call 'refreshRow' or 'updateRow' method.


Title: Re: Datagrid => rowstyle after user event
Post by: acreonte82 on June 07, 2020, 06:23:33 AM
Sorry, I don't understand your answer.
This is the function called after an user event:
Code:
function mouveRowDg_toTop(dg,indexRow,row)
{
if (indexRow > 0)
{
  dg.datagrid('deleteRow', indexRow);
  dg.datagrid('insertRow', {index:0,row:row});
  dg.datagrid('selectRow', 0).datagrid('scrollTo', 0);
}
}

The datagrid is loaded with all element, the problem is: put the text on bold with a backgroud color, after the row is mouved to the top.

How I can do it?


Title: Re: Datagrid => rowstyle after user event
Post by: jarry on June 13, 2020, 09:16:46 PM
Define the 'rowStyler' to make the text bold. Set the 'is_bold' of a row to make turn on or off the bold style. Please try the code below.
Code:
$(function(){
  $('#dg').datagrid({
    rowStyler: function(index,row){
      if (row.is_bold){
        return 'font-weight:bold'
      }
    }
  })
})
function mouveRowDg_toTop(dg,indexRow,row)
{
  if (indexRow > 0)
  {
    row.is_bold = true;
    dg.datagrid('deleteRow', indexRow);
      dg.datagrid('insertRow', {index:0,row:row});
      dg.datagrid('selectRow', 0).datagrid('scrollTo', 0);
  }
}


Title: Re: Datagrid => rowstyle after user event
Post by: acreonte82 on June 15, 2020, 10:50:23 AM
Thanks! it  Works!!
Many many Thanks!!!!!!!!