Why Select box being selected without any action
Why Select box being selected without any action
Link to test case: http://199.241.138.6/demo/
Debugger code (debug.datatables.net): ugumes
Error messages shown: No
Description of problem:
I modified the Join example in the Inline-editing. The modification is not to use join table, the options of the select box is like this
{
label: "Site:",
name: "users.site",
type: "select",
options: [
{ label: "Admin", value: "1" },
{ label: "Mod", value: "2" },
{ label: "User", value: "3" }
]
},
To render the name instead of the value, I use:
{ data: "users.site",
render: function(data, type, row, meta) {
var m = "Select Site";
if (row.users.site == 1) m = "A";
if (row.users.site == 2) m = "B";
if (row.users.site == 3) m = "C";
return m;
}
},
It works fine if there is only one Select box, but if there are more, the other Select box (Role) will be selected automatically (and the first value is selected) when Select box (Site) is selected. I could not figure out what wrong did I make!
How to have the value of each Select box separately? please help!
Answers
Thanks for the link. It looks like you need a placeholder for the select box to allow an empty value to be the chosen one. See the
select
docs (specifically the variousplaceholder*
options) for how that can be done.Allan
Thank you alan, adding placeholer did work