Hi Paramvir,
I am using jquery 2.2.0 for one of my projects.
Right now I am using multiselect but there are some problems with it.
My Custom editor has some logic and depends on the row number is different.
For row #4 it should be multiselect. What is the easier way to implement it?
So far I have:
var abnrmCondEditor = function (ui) {
var $cell = ui.$cell,
rowData = ui.rowData,
dataIndx = ui.dataIndx,
cls = ui.cls,
dc = $.trim(rowData[dataIndx]),
wdth = ui.column.width-4;
$.ajax({
url: 'getAbnormalCodes.do',
type: 'GET',
dataType: "json",
async: false,
success: function(json_arr) {
if (json_arr) {
var options="", code, desc;
//alert(dc);
$.each(json_arr, function(i,val) {
code = val.valueIndx,
desc = val.labelIndx.toUpperCase();
//alert("DC:"+dc);
if (dc && dc.toUpperCase() == desc) {
options = options + "<option selected='selected' value="+code+">"+desc+"</option>";
} else {
options = options + "<option value="+code+">"+desc+"</option>";
}
});
var $dropdownField = $("<select name='" + dataIndx + "' class='"+cls+" grp-cmb-abnrml-cond pq-ac-editor' multiple='multiple'>"+options+"</select>")
.appendTo($cell).val(dc.split(','));
$dropdownField.multiselect({
selectedList: 2,
minWidth: wdth,
noneSelectedText: "",
click: function() {
var selections = $.map($(this).multiselect("getChecked"),function( input ){
return input.value;
});
alert("Selections:" + selections);
$dropdownField.appendTo($cell).val(JSON.stringify(selections));
// //$("#grid_group_lc_hdr_2").pqGrid( "quitEditMode" );
},
close: function() {
$("#grid_group_lc_hdr_2").pqGrid("quitEditMode");
}
});
} else {
alert('Failed to upload Abnormal Conditions');
}
},
error: function (xhr, ajaxOptions, thrownError) {
alert('Failed to upload Abnormal Conditions');
}
});
}