Background Java code
@RequestMapping (params = "Command=adduser")
public void GetUser (HttpServletResponse response) throws exception{
Jsonobject result1 = new Jsonobject ();
Jsonarray rows1 = new Jsonarray ();
String search = "1=1";
list<inducedcause> list = inducedcauseservice.getinducedcauselist (search);
Jsonobject UX = NULL;
for (Inducedcause uc:list) {
ux= new Jsonobject ();
Ux.put ("id", Uc.getid ());
Ux.put ("Reason", Uc.getreason ());
Rows1.put (UX);
}
Result1.put ("Results1", rows1);
Result.put ("TotalCount", List.size ());
Response.getwriter (). Write (result1.tostring ());
}
Front desk ExtJS Code
var comstore1 = new Ext.data.Store (
{proxy:new Ext.data.HttpProxy ({url: ' ${pagecontext.request.contextpath}/treatmentrecord/treatmentrecord.page? Command=adduser '}),
Read JSON
Reader:new Ext.data.JsonReader ({
Root: ' Results1 ',
Remotesort:true,
Fields: [' id ', ' Reason ']})
});
{
Xtype: ' Lovcombo ',
Fieldlabel: ' Inducing cause ',
ID: ' Inducedcause-id ',
Name: ' Inducedcause ',
Displayfield: ' Reason ',
Valuefield: ' id ',
Hiddenname: ' id ',
Mode: ' Local ',
Editable:false,
Loadingtext: ' Loading ... ',
Store:comstore1,
Value: ' <%=realname%> ',
Emptytext: ' Please choose the reason ',
TriggerAction: ' All ',
MAXLENGTH:100,
Multiselect:true,
Anchor: ' 100% '
},
To implement a multi-select drop-down box to introduce two JS class libraries
<link rel= "stylesheet" type= "Text/css" href= "${pagecontext.request.contextpath}/ext/examples/ux/css/ Ext.ux.form.LovCombo.css"/>
<script type= "Text/javascript" src= "${pagecontext.request.contextpath}/ext/examples/ux/ EXT.UX.FORM.LOVCOMBO.JS "></script>
Otherwise, the single-selection drop-down box, the data is dynamic
Beginner ExtJS, hoping to help people in need
ExtJS dropdown box, multiple selection, single selection, dynamic transfer value