EasyUI Forum
April 28, 2024, 07:45:13 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: set default value in datagrid cells under conditions  (Read 9252 times)
pedroc
Newbie
*
Posts: 17


View Profile
« on: April 07, 2015, 08:40:59 AM »

I have a datagrid with editable rows and I need each cell by default has the value 0.00 and if clear the value of the cell to another cell the value 0.00 is set
« Last Edit: April 08, 2015, 05:32:11 AM by pedroc » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: April 07, 2015, 06:18:25 PM »

The simplest way to solve this issue is to initialize the row values before editing it.
Code:
$('#dg').datagrid({
onBeforeEdit: function(index,row){
row.listprice = row.listprice||0;
row.unitcost = row.unitcost||0;
}
})
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!