EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Pierre on April 15, 2016, 04:47:46 AM



Title: [SOLVED] How to get field value when using cell edit?
Post by: Pierre on April 15, 2016, 04:47:46 AM
Hello all
I'm using extension: http://www.jeasyui.com/extension/datagrid_cellediting.php
and everything works perfect.
What I need is to get datagrid value using "onBeforeCellEdit" event so I can cancel edit if needed.
Usually, I'm using

Code:
  if($('#dg').datagrid('getSelected').myfield=="ok"){
   ...
  else{
   return;
  }

but it does not worked.. How to get myfield value when using cell edit (and when editing other value then "myfield"?
Thank you.


Title: Re: How to get field value when using cell edit?
Post by: stworthy on April 15, 2016, 11:41:05 PM
You can get the current row in 'onBeforeCellEdit' event.
Code:
onBeforeCellEdit:function(index,field){
var row = $(this).datagrid('getRows')[index];
...
}


Title: Re: How to get field value when using cell edit?
Post by: Pierre on April 16, 2016, 12:51:52 AM
Awesome, thank you Stworthy!