Pen to write the text before, first to remind himself, because always remember, and even the great God colleagues began to use "despise" the eyes of their own- encountered problems, their own to solve, no problem is solved, do not seriously work hard before you go to trouble big God colleagues, remember! The same problem, hope really can remember, remember!
Do you remember to use the ComboBox in Easyui? The effect is Jiangzi drop:
Ordinary use of the time, that is very common drop-down box, that is, single-choice, but we have encountered in the work of this drop-down box into a multi-box style, namely:
In fact, a "multi-select" attribute is added to the usual reference:
<input id= "Steels" name= "Stids" class= "Easyui-combobox" data-options= "prompt: ' Please select steel Mills ', Valuefield: ' ID ', TextField: ' Name ', Multiple:true,url: '/vip/users/steellist ', panelheight: ' 200px '"style=" width:150px " >
The problem arose Jiangzi:
Before the first option, a comma is inexplicably more than one. This problem, in fact, from the beginning of their own projects have been discovered before, but this is also "sporadic", I did not figure out why this situation, but also a bit of luck, thinking about the final solution, until today, the work at hand is almost over, the bug is completely turned out, So a small one afternoon time, all in the study of what is the matter, perhaps never have confidence in themselves, in professional issues, always dare not say their own ideas, so to the end or ask the Boss, the results can be imagined: scolded that is necessary ~ ~ (this week, where is the problem, Always let people think that they are no longer the state, error frequency, hope to enter the state next week! )
It's a long way off ... Back to the chase:
On the question of commas, in fact, the key is not in the ComboBox itself component problem, but because of their own reasons: because we are doing the project basically to do "add and delete to check", such as adding new members, and then should be added to the page just now, and I used a "groceries reduction" method, because the entire modified page is written in the form form, so when the data is echoed, the Jiangzi drops directly:
// Assign Value
This thought flawless, the workmanship, but did not want to forget a major problem: the new or modified page is written in the form form, but the above-mentioned multi-box data before load, if there is no data in the database, that is, the value is empty, load in the case, will default to add a "", This is why the first data before the comma, at the beginning, I thought this is the component itself bug, no chengxiang is their own problem, really feel ashamed! The Final Solution is:
JQuery (' #steels '). ComboBox (' Clear '); jQuery (// assignment
The value of the drop-down box is emptied before the load value, so that "" is deleted.
Summarize:
1. When using the plug-in, must be against the official documents, careful and careful study, do not "generalize", such as: Easyui Many components have clear method, so they think Datetimebox also have clear method, The result is a value in the time control if it is pasted or copied over, it is invalid, and the correct one is to it. ("SetValue", ""), SetValue is empty;
2. In the accident, we must solve the problem first, certainly!
The multi-box of the ComboBox--the comma chapter