EasyUI Forum
March 29, 2024, 12:52:26 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Datagrid => rowstyle after user event [SOLVED]  (Read 10669 times)
acreonte82
Jr. Member
**
Posts: 85



View Profile
« 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
« Last Edit: June 15, 2020, 10:57:03 AM by acreonte82 » Logged
jarry
Administrator
Hero Member
*****
Posts: 2260


View Profile Email
« Reply #1 on: May 30, 2020, 06:40:46 AM »

Please define the 'rowStyler' and then call 'refreshRow' or 'updateRow' method.
Logged
acreonte82
Jr. Member
**
Posts: 85



View Profile
« Reply #2 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?
Logged
jarry
Administrator
Hero Member
*****
Posts: 2260


View Profile Email
« Reply #3 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);
  }
}
Logged
acreonte82
Jr. Member
**
Posts: 85



View Profile
« Reply #4 on: June 15, 2020, 10:50:23 AM »

Thanks! it  Works!!
Many many Thanks!!!!!!!!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!