EasyUI Forum
September 16, 2025, 03:43:53 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: Disable First column in dragdrop plugin of datagrid  (Read 6108 times)
Darrel
Jr. Member
**
Posts: 74


View Profile
« on: January 08, 2016, 07:08:36 AM »

Hello,

I've referred the code to create a datagrid which has draggable columns. I've managed to integrate the plugin with the datagrid plugin that I'm using http://www.jeasyui.com/forum/index.php?topic=279.0. However I have one requirement, i.e, I want to restrict the user from dragging and dropping some beginning columns of the datagrid.

For eg, like in case of a datagrid with checkboxes in the first column. I don't want the checkbox column to be draggable. How can I impose this restriction on the user?

Thanks & Regards,
Darrel
Logged
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #1 on: January 09, 2016, 12:56:29 AM »

Please download the datagrid columns extension file from http://www.jeasyui.com/extension/columns_ext.php. Returning false in 'onBeforeDragColumn' event to prevent from dragging a column.
Code:
$('#dg').datagrid({
  onBeforeDragColumn: function(field){
    if (field == 'ck') return false;
  }
}).datagrid('columnMoving');
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!