Notes for default combobox values in EasyUI
This article mainly introduces the precautions for the default value of combobox in EasyUI. It refers to the issues encountered and solved by individuals in the project. For more information, see.
When modifying data, you must load the data first.
When loading the combobox data, int-type data is sent from the background.
Html code
The Code is as follows:
<Tr>
<Td style = "text-align: right;"> faculty: </td>
<Input type = "hidden" id = "belongsvalue" value = "$ {fbook. belongs}"/>
<! -- Data must be int; otherwise, it is automatically selected in the drop-down box -->
<Td>
<Input name = "belongs" id = "belongs"> </input>
</Td>
</Tr>
Javascript code
The Code is as follows:
$ ('# Belongs'). combobox ({
Url: 'opr/book/combobox. do ',
ValueField: 'id ',
TextField: 'name ',
Width: '200 ',
Height: '29 ',
Editable: false,
PanelHeight: 'auto ',
OnLoadSuccess: function (data ){
Var b1 = $ ('# belongsvalue'). val (); // b1 is int type data
$ ('# Belongs'). combobox ('setvalue', b1 );
}
});
The above is all the content of this article. I hope it will help you.