ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: stoodin on April 04, 2014, 10:33:00 pm
-
Hi guys,
Can someone show me how to use the checkboxdropdownlist,especially https://github.com/wenzhixin/multiple-select
I am trying to create a custom editor but it doesn't work:
var selectEditor = function (ui) {
var dataIndx = ui.dataIndx;
var options = ['', 'FName1 LName1','FName2 LName2','FName3 LName3'],
str="";
for (var i = 0; i < options.length; i++) {
var opt = options;
str += "<option>" + opt + "</option>";
}
var $sel = $('<select id="example" name="' + dataIndx + '" multiple="multiple" >' + str + "</select>");
$sel.multipleSelect();
};
Thanks in advance.
-
you are almost there
2 corrections:
var opt = options[ i ];
$sel.appendTo( ui.$cell )
Example of custom editor:
http://paramquery.com/pro/demos/editing_custom
-
Thanks a lot.
Still not working. It shows just standard HTML dropdown multiselect. But I want to see http://wenzhixin.net.cn/p/multiple-select/
Here is my new version of the editor:
var selectEditor = function (ui) {
var options = ['', 'FName1 LName1','FName2 LName2','FName3 LName3'],
str="";
for (var i = 0; i < options.length; i++) {
str += "<option>" + options + "</option>";
}
var $sel = $('<select id="example" name="'+dataIndx+'" multiple="multiple" >'+str+"</select>")
.appendTo(ui.$cell)
.multipleSelect();
};
-
you can try to wrap multiselect in a setTimeout
window.setTimeout(function(){
$sel.multipleSelect();
}, 0);
-
hmm,
Works partially now: (Doesn't show the options values, just an empty "Select All" and one empty checkbox.
It works fine without grid though...
var selectEditor = function (ui) {
var $cell = ui.$cell,
rowData = ui.rowData,
dataIndx = ui.dataIndx,
cls = ui.cls,
dc = $.trim(rowData[dataIndx]);
var options = ['', 'FName1 LName1','FName2 LName2','FName3 LName3'],
str="";
for (var i = 0; i < options.length; i++) {
str += '<option value="' + i + '">' + options + '</option>';
}
var $sel = $('<select id="example" multiple="multiple" name="' + dataIndx + '" >'+str+"</select>")
.appendTo($cell)
.val(dc)
.multipleSelect({
width: ui.column.width
});
};