EasyUI Forum
May 16, 2024, 12:33:11 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: Remove Grid Row  (Read 16527 times)
arma
Full Member
***
Posts: 110


View Profile
« on: November 11, 2015, 03:46:37 AM »

Hi,

What is the best way to remove grid row while in cell editing mode? I could find it the information here http://www.jeasyui.com/extension/datagrid_cellediting.php

Thanks.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: November 11, 2015, 08:13:34 AM »

You can call 'deleteRow' method to delete a row. If this row is in editing mode, please call 'cancelEdit' method to end the editing and then call 'deleteRow' method to delete it.
Code:
$('#dg').datagrid('cancelEdit', index);
$('#dg').datagrid('deleteRow', index);
Logged
arma
Full Member
***
Posts: 110


View Profile
« Reply #2 on: November 11, 2015, 04:18:41 PM »

Thanks stworthy,

I have now another issue:

1. Load grid with some data and call the grid enableCellEditing
2. I then empty the grid and insertRow with index 0.
3. After i click cell and edit a field, the grid become frozen.

Do you have any clue to solve this?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: November 11, 2015, 07:23:58 PM »

Please refer to http://jsfiddle.net/jw0y2p54/. It works fine.
Logged
arma
Full Member
***
Posts: 110


View Profile
« Reply #4 on: November 12, 2015, 03:48:06 AM »

Awesome  Grin thank you.
Logged
arma
Full Member
***
Posts: 110


View Profile
« Reply #5 on: January 02, 2016, 03:49:24 PM »

Hi Stworthy,

It looks like calling getSelected on editable cell grid return null, so that i could not get the selected row index.
It even does not trigger onSelect row method. Is it considered as a bug ?

Please check the js fiddle link here. http://jsfiddle.net/72m654kg/1/


My workaround at the moment is to maintain global variable to store the selected row from ClickRow even and later get the index from that variable.

Code:
var selectedRow = null;
...
onClickRow: function(index, row){
     selectedRow = row;
}
...
//I user selectedRow to get index to use as deleteRow parameter.
« Last Edit: January 02, 2016, 06:21:07 PM by arma » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #6 on: January 02, 2016, 06:20:06 PM »

When you enable cell editing on a datagrid, you can not select a whole row but only one cell at a time. Please call 'cell' method to get the selected cell index and field name.

http://jsfiddle.net/72m654kg/4/
Logged
arma
Full Member
***
Posts: 110


View Profile
« Reply #7 on: January 02, 2016, 06:28:23 PM »

Thanks a lot, your solution is much simpler Cheesy
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!