Easyui and assignment of-numberbox control in front-end frame

Source: Internet
Author: User

Easyui Front-End Frame connection address click Open link

Here's a simple summary of the I-type. Some usage issues with the Numberbox control.


Case One: Numberbox control common use

First step: Introduce some properties of Numberbox.

1.value= the value in the "123.23"//Number box

2.precision:2//precision (two digits after decimal point)

3.groupSeparator: ', '//(group separator)

4.decimalSeparator: '//(alternate decimal separator)

5.prefix: ' € '//(prefix character)

6.suffix: ' $ '//(suffix character)

7.min,max (minimum, maximum) Step two: Describes the value and assignment of the Numberbox control.

Simple HTML tag, set to Numberbox control

<input class= "Easyui-numberbox" disabled= "disabled" id= "Amount" data-options=: ', ' "/>

For this input tag, we get this object based on the id= "amount" and assign the value and value.

Assign value:

$ ("#amount"). Numberbox (' SetValue ', 123);

Take value:

var value=$ ("#amount"). Numberbox (' GetValue ');


case Two: The use of the Numberbox control in the DataGrid list.


If you use the Numberbox control in the DataGrid


First look at the table HTML structure


<table id= "Slist1eg" class= "Easyui-datagrid" style= "height:330px" data-options= "Singleselect:true" > <thead> <tr> <th data-options= "halign: ' Center ', field: ' PartNo ', width:1 20,align: ' Left ' > accessory number </th> <th data-options= "HAlign: ' Center ', field: ' PartName ', width:100,align: ' Left '" > Accessories name </th&gt
                    ; <th data-options= "halign: ' Center ', Field: ' Qty ', Width:100,align: ' Right ', Editor:{type: ' Numberbox '}, Formatt Er:function (V,row,index) {if (v!=null) {return v} ' else {return 1}} ' > <span style= ' color:red ' & Gt;*</span> quantity </th> <th id= "Price" data-options= "halign: ' Center ', fi Eld: ' Price ', width:100,align: ' Left ', formatter:function (v,row,index) {return Fmoney (V, 2);} "
                 >       Unit Price </th> <th data-options= "halign: ' Center ', field: ' Amount ', Width: 120,align: ' Right ', formatter:function (v,row,index) {if (row.qty!=null) {var num=row.price * row
													 . qty} else {var num=row.price} row.amount = num; Return Fmoney (num,2);} " > Amount </th> <th data-options= "halign: ' Center ', Field: ' Remark ', width:140,align: ' Left ', Editor:{type: ' Text '} ' > Memo information </th&

                    Gt
                    <th data-options= "halign: ' Center ', field: ' Spection ', width:100,align: ' Left '" > Specification model </th> <th data-options= "halign: ' Center ', field: ' Partunit ', width:100,align: ' Left '" &
                        Gt Unit </th> <th data-options= "halign: ' Center ', field: ' WeIght ', width:100,align: ' Left ' > Weight </th> </tr> </thead> </table>

Get tabular data by getting data from the DataGrid based on the ID of the table label

var tab=$ ("#slist1Eg"). DataGrid (' GetRows ');

Gets the row data for the selected row.

var row=$ ("#slist1Eg"). DataGrid (' getselected ');

Iterate through the tab data to modify the data for the specified cell

for (var i = 0; i < tab.length i++) {
              
   $ (' #slist5Eg '). DataGrid (' Updaterow ', {index:i,
      row:{name:value});     

  }
Where name refers to the name field of the table column, value refers to the desired values


Summing up, the reason for the collation of the content of the Numberbox control, is purely helpless, for the Numberbox control defined whether the cell or the input box, when assigning value to confirm the format of the value.

If you define a cell that is an editable type of number cell, the first time you enter a numeric success, but there may be an exception when you modify it, it is very likely that the value you entered conflicts with the assignment format defined by the Nemberbox control.

The problem I'm having today is to evaluate the first two cells and assign the result to the third cell.

Iterate through each row of data, and the results are assigned to the third cell, showing that everything is OK, but once you click on the third cell, you'll see that the value changes. The reason is that the value I calculated has a spacer (for example, 123,000.50) when the Numberbox control does not recognize the value, it is possible to click the assigned cell again for an exception.

Processing recommendations: Format the number, remove the spacer, everything is normal.






















Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.