jQgrid를 생성하는 데 다음 코드가 있지만 select 아이콘을 클릭하면 select2 목록이 비어 있습니다. select2 코드를 제거하면 목록이 잘 채워집니다.jQuery select2를 jQgrid에 채우는 방법
jQuery를 1.11.3 있는 jqGrid 무료 4.13 내가 선택을 위해이 4.0.3 단지 다른 파일이 불필요한 될 것 같다 CSS
<table id="csstsoservicebulletinassignment"></table>
<div id="csstsoservicebulletinassignmentpager"></div>
<script type="text/javascript">
//var serialnumbervalidation = false;
$(document).ready(function(){
var selID = "";
var temp = "";
var sourcevalue = "";
var requestedchangelink = "";
$("#csstsoservicebulletinassignment").jqGrid({
url:'/QMSWebApp/CSSTSOControllerServlet?lifecycle=loadservicebulletinassignmentbodysection',
editurl:'/QMSWebApp/CSSTSOControllerServlet?lifecycle=editservicebulletinassignmentbodysection',
datatype: "json",
height: "auto",
colNames:['Index#','CO#','iService Bulletin#','Service Bulletin#'],
colModel:[
{name:'id', index:'id', width:60, hidden: true, editable: true, editoptions:{ readonly:'readonly'}, editrules:{edithidden:true}, formoptions:{rowpos:1, colpos:1,label:"Index#:"}},
{name:'cono', index:'cono', width:60, hidden: true, editable: true, editrules:{edithidden:true}, formoptions:{rowpos:2, colpos:1,label:"CO#:"}},
{name:'sbnoindx', index:'sbnoindx', width:60, hidden: true, editable: true,
editrules:{edithidden:true}, formoptions:{rowpos:3, colpos:1,label:"Service Bulletin#:"},
edittype: "select",
editoptions: { dataUrl: '/QMSWebApp/CSSTSOControllerServlet?lifecycle=servicebulletinoptions',
selectFilled: function (options) {
$(options.elem).width(122).select2({
dropdownCssClass: 'ui-widget ui-jqdialog',
//width: '100%'
});
}},
stype: "select",
searchoptions: { dataUrl: '/QMSWebApp/CSSTSOControllerServlet?lifecycle=servicebulletinoptions',
selectFilled: function (options) {
$(options.elem).width(122).select2({
dropdownCssClass: 'ui-widget ui-jqdialog',
//width: '100%'
});
}
}},
{name:'sbnolink', index:'sbnolink', width:500, hidden: false},
],
onSelectRow: oSelect,
rowNum:10,
rowList:[10,15,20,25,30],
loadonce: true,
pager: '#csstsoservicebulletinassignmentpager',
viewrecords: true,
gridview: true,
loadComplete: lComplete,
caption:"Service Bulletin Assignment"
});
$("#csstsoservicebulletinassignment").jqGrid('navGrid','#csstsoservicebulletinassignmentpager',
{edit:false,add:true,del:true,search:true,view:false,
beforeRefresh: function(){
$("#csstsoservicebulletinassignment").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid');
}},
{url:'/QMSWebApp/CSSTSOControllerServlet?lifecycle=editservicebulletinassignmentbodysection',
recreateForm: true,
width: 400,
zIndex: 500992,
viewPagerButtons: false,
beforeShowForm: bsEditForm,
afterShowForm: asEditForm,
checkOnSubmit: false,
afterSubmit: asubEditForm,
},
{recreateForm: true,
zIndex: 500992,
beforeInitData: biAddForm,
beforeShowForm: bsAddForm,
afterShowForm: asAddForm,
beforeSubmit: bsubAddForm,
checkOnSubmit: false,
afterSubmit: asubAddForm,
afterComplete: afComp,
width: 400,
},
{zIndex: 500992},
{zIndex: 500992},
{recreateForm: true,
zIndex: 500992,
width: 400,
viewPagerButtons: false
}
);
function lComplete(data){
$('.viewservicebulletincontext').on("click", function(){
var servicebulletinno = this.getAttribute("data-servicebulletin");
progress();
setTimeout(function(){
$('.miscdisplay2').load("/QMSWebApp/CSSTSOControllerServlet",
{lifecycle:"viewservicebulletincontext",servicebulletinno:servicebulletinno});
$('.miscdisplay2').show("slide", { direction: "right" }, 1000);
},100);
});
hideProgressDisplay();
};
function oSelect(id){
//$("#csstsoservicebulletinassignment").setColProp('twotype', { editoptions: { dataUrl: '/QMSWebApp/CSSTSOControllerServlet?lifecycle=twotypeoptions'}});
};
function bsEditForm(formId){
$('#tr_id', formId).hide();
$('#tr_cono', formId).hide();
$('#tr_sbnolink', formId).hide();
}
function asEditForm(formId){
}
function asubEditForm(response, postdata){
return [true,"Ok"];
}
function biAddForm(formId){
//$("#csstsoservicebulletinassignment").setColProp('sbnoindx', { editoptions: { dataUrl: '/QMSWebApp/CSSTSOControllerServlet?lifecycle=servicebulletinoptions', selectFilled: function(options){$(options.elem).select2({dropdownCssClass: "ui-widget ui-jqdialog",width: "100%"});}}});
};
function bsAddForm(formId){
$('#tr_id', formId).hide();
$('#tr_cono', formId).hide();
$('#tr_sbnolink', formId).hide();
}
function asAddForm(formId){
}
function bsubAddForm(postdata, formid){
return [true,"Ok"];
//}
}
function afComp(response,postdata,formId){
}
function asubAddForm(response, postdata){
var res = $.parseJSON(response.responseText);
if(res){
if(!res.errorCode){
return [false,res.message];
}
else{
return [true,"Ok"];
}
}
else{
return [true,"Ok"];
}
}
$('.csstsoservicebulletinassignmentFormClose').on("click", function(){
//$('.miscdisplay2').hide("slide", { direction: "right" }, 1000);
$('.miscdisplay').hide("slide", { direction: "right" }, 1000);
});
});
[답변] (http : //) 용으로 만든 [데모] (http://www.ok-soft-gmbh.com/jqGrid/OK/formEditOnDoubleClick-jqueryui-fa3.htm)를보십시오. stackoverflow.com/a/37876387/315935). 그것은 select2와 함께 무료 jqGrid를 사용하며 양식 및 인라인 편집과 함께 작동합니다. 게시 한 코드에는 다른 많은 것들이 포함되어 있습니다. 문제를 재현하는 데모를 보지 않고도 정확히 어떤 문제인지 결정하는 것은 어렵습니다. 아마도 내 데모와 코드를 비교하면 문제를 볼 수 있습니다. – Oleg
어떤 이유로 데모가 열리지 않습니다. –
@Oleg 방금 추가 양식을 이동했는데 목록이 양식 아래에 표시되었습니다. 따라서 Z- 색인 문제 여야합니다. select2 목록을 맨 위에 올리는 방법이 있습니까? 추가 양식의 Z- 색인은 500992입니다. –