Although combobox provides the emptyText attribute, it is not very easy to use. In actual applications, we often need to restore to the null state, that is, nothing goes first. Once you select a certain option, you cannot return to the null state.
Original code
// Payment Method
Var Fukuanstore = new Ext. data. Store ({
BaseParams :{
Paramname: 'payment Method'
},
Proxy: new Ext. data. HttpProxy ({
Url: "DATA/paramvalue/GetParam. aspx ",
Method: "POST"
}),
Reader: new Ext. data. JsonReader ({
Fields: ["id", "param_value", "paramclass_id"],
Root: "data ",
Id: "id ",
TotalProperty: "totalCount"
})
});
After modification:
// Payment Method
Var Fukuanstore = new Ext. data. Store ({
BaseParams :{
Paramname: 'payment Method'
},
Proxy: new Ext. data. HttpProxy ({
Url: "DATA/paramvalue/GetParam. aspx ",
Method: "POST"
}),
Reader: new Ext. data. JsonReader ({
Fields: ["id", "param_value", "paramclass_id"],
Root: "data ",
Id: "id ",
TotalProperty: "totalCount"
}),
Listeners :{
// Insert a new data entry into existing data
Load: function (store, records, options ){
Var data = {"id": "", "param_value": "All payment methods", "paramclass_id ":""};
Var rs = [new Ext. data. Record (data)];
Store. insert (0, rs );
}
}
});
Display Effect:
From suixufeng's column