"Easyui"--combobox--assigns and gets the selected value
/Initialize the dropdown box $ (' #communityIdDiv '). ComboBox ({ url:basepath+ "Pushcontroller/querycommonityname", Valuefield: ' col_id ', textField: ' col_name ', panelheight:80, selectonnavigation:false, Loadfilter:function (data) { var o = [{' col_id ': ' 0 ', ' col_name ': '--full push--'}]; $ (' #communityIdDiv '). ComboBox ("select", 0); return O.concat (data) , onselect:function (record) { //Gets the data in the drop-down in var = $ (' #colOperateDiv ') . ComboBox ("GetData"); Gets the value of the lable location, typically something like the primary key var lable = $ ("input[name= ' Colcommunityid ')"). Val (); Iterates through all the data in the drop-down box in the array form for (var index in data) { if (data[index].col_id==lable) {
$ ("#_easyui_combobox_i1_" +index). Text () is the dynamic access to the selected data (human eye directly see)
$ (' #td4 '). Text ($ ("#_easyui_combobox_i1_" +index). Text ());}}} );
Front page wording:
<div id= "Communityiddiv" name= "Colcommunityid" ></div>
1234567891011121314 |
$(
‘#newstype‘
).combobox({
url:
‘${ctx}/manage/news/newstype_comboxjson‘
,
valueField:
‘id‘
,
textField:
‘typename‘
,
panelHeight:
‘auto‘
,
required:
‘true‘
,
editable:
‘false‘
,
onLoadSuccess:
function () {
var data = $(
‘#newstype‘
).combobox(
‘getData‘
);
if (data.length > 0) {
$(
‘#newstype‘
).combobox(
‘select‘
, data[0].id);
}
}
});
|
Easyui How to get the ComboBox value
$ (' #com '). ComboBox (' GetValue ') gets the currently selected value
$ (' #com '). ComboBox (' GetText ') gets the currently selected text
JSP common Form form controls