Easyui-combobox default settings, get multi-select value and JS include string, delete string

Source: Internet
Author: User

1, the project uses to the ComboBox the multi-select value and the related operation, does not say more, directly on the code:

<input id= "Education" name= "Education" class= "Easyui-combobox" data-options= "method: ' Get ', Valuefield: ' ID ', TextField: ' name ',multiple:true, panelheight: ' Auto ', Required:true,url: ' ${ctx} ', Editable:false,value : ' AA ',loadfilter:function (data) {if (null==data) return [];var DD = [];  Dd.push ({id: ' AA ', Name: ' Unlimited '}); for (var i=0; i<data.length; i++) {Dd.push (data[i]);} return DD;} " />

Multiple:true----Set ComboBox multiple selection

Value: ' AA ',
Dd.push ({id: ' AA ', Name: ' Unlimited '});------combination to determine the default value

2, ComboBox get multi-select value and JS split string

var education = $ ("#education"). ComboBox ('getValues');//Get multiple selection values

Note: The combobox gets a multiple-selection value for the array. 21, 22, 23

Determines whether to include Aafunction contains (arr) {var i = arr.length-1;//from the array to determine if STR exists while (i--) {if (arr[i] = = = ' AA ') {return true;}} return false;} Remove the contained string function Removestr (arr) {var arrnew = new Array ();//delete the specified strfor from the array (var i = 0; i < arr.length; i++) {if (' AA ')! = Arr[i]) {Arrnew.push (arr[i]);}} return arrnew.tostring ();}

More flexible settings can be passed into different strings for judgment and removal, here is a sample.

Easyui-combobox default settings, get multi-select value and JS include string, delete string

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.