EasyUI Forum
May 12, 2024, 07:11:49 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: jeasyui numberbox  (Read 13393 times)
ui_user
Newbie
*
Posts: 6


View Profile
« on: December 15, 2013, 10:00:08 PM »

Hi Team,

i am new to jquery and jeasyui. i am using easyui-numberbox. i have mentioned the precision as 4. But even though if the value coming from database is 1.25, the value in the ui is getting displayed as 1.2500. Is there any way to avoid this?

Please help me with this.

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


View Profile Email
« Reply #1 on: December 15, 2013, 11:37:16 PM »

Setting 'precision' to 4 means that the digit number after decimal separator is 4. You can override the 'formatter' function to customize your implementation.
Code:
<input class="easyui-numberbox" value="1.25" required data-options="
precision:4,
formatter:function(value){
var value = $.fn.numberbox.defaults.formatter.call(this,value);
value = parseFloat(value);
return value;
}">
Logged
ui_user
Newbie
*
Posts: 6


View Profile
« Reply #2 on: December 16, 2013, 03:57:48 AM »

Thank you stworthy .

It worked, But when the filed is focuses (cursor is placed for editing), then the value is again getting set with precision as 4.

Regards,
user
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: December 16, 2013, 05:14:10 PM »

Please refer to this example http://jsfiddle.net/c3HDF/. It works as what you expected.
Logged
ui_user
Newbie
*
Posts: 6


View Profile
« Reply #4 on: December 17, 2013, 04:11:43 AM »

Thank you.
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!