EasyUI Forum
April 19, 2024, 07:41:44 PM *
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 disable one or more row(s)  (Read 8153 times)
sky-t
Full Member
***
Posts: 145


View Profile
« on: May 21, 2017, 12:09:08 AM »

Hi there,

is there a possibility to disable one or more rows in a datagrid?


Thanks for help!
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: May 21, 2017, 01:26:29 AM »

You can define the 'rowStyler' function to customize the style for some specified rows.
Logged
sky-t
Full Member
***
Posts: 145


View Profile
« Reply #2 on: May 21, 2017, 02:00:19 AM »

Hi jarry,

first thank you - i know the rowStyler function - but how can i use it to disable a row?


Thanks again
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #3 on: May 21, 2017, 04:03:00 AM »

Use the 'rowStyler' to set the row style and use the 'onBeforeSelect' to determine whether a row can be selected. What is the purpose of disabling rows in datagrid?
Logged
sky-t
Full Member
***
Posts: 145


View Profile
« Reply #4 on: May 21, 2017, 10:06:45 AM »

i want to show a list of all connected users - in this list i want the users to allow to select other users to send them a message for example. The current user is also in this list and i makes no sense if this user sends a message to himself.

Wo this row for each current user should be disabled.


Thank you jarry
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #5 on: May 21, 2017, 03:33:23 PM »

You only need to prevent the user from selecting some rows. Please return false in the onBeforeSelect event handler regarding some conditions.
Code:
$('#dg').datagrid({
  onBeforeSelect:function(index,row){
    if(...) return false
  }
})
Logged
sky-t
Full Member
***
Posts: 145


View Profile
« Reply #6 on: May 21, 2017, 09:22:55 PM »

Hi jarry,

thank you for your help - i think this way will work.
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!