EasyUI Forum
May 08, 2024, 01:48:08 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: Calculate two column values in editing DataGrid  (Read 7847 times)
rezzonico
Full Member
***
Posts: 183


View Profile
« on: February 20, 2014, 09:44:37 AM »

Hi all,

I am trying to modify the example "Calculate two column values in editing DataGrid" found here:
http://www.jeasyui.com/tutorial/datagrid/datagrid15.php
In this example the involved fields (listprice, amount and unitcost) are numberbox.

The only difference in my situation is that the field "amount" is a combobox (and not a numberbox).
It seems me that for a combobox it's not possible to use the function:
 "amountEditor.target.bind('change')"

The only solution that I have found is to add an "onChange" event to the field "amount".
This event calls a new function (for example setEditing2).

What I do not like in this (working) solution is that "setEditing" and "setEditing2" are two different functions but are very similar.

Is this the only solution or is it possible to use "amountEditor.target.bind('change')" also with combobox ?

Regards.
Miche
« Last Edit: February 20, 2014, 12:31:45 PM by rezzonico » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: February 20, 2014, 03:41:17 PM »

Please try to override the default 'onChange' event handler, in which trigger the 'change' event for the target element:
Code:
$.fn.combobox.defaults.onChange = function(value){
    $(this).val(value);
    $(this).trigger('change');
}
Logged
rezzonico
Full Member
***
Posts: 183


View Profile
« Reply #2 on: February 21, 2014, 06:08:18 AM »

It works !
Thanks a lot for your help !

Miche
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!