使用数据库在jqgrid中编辑弹出窗口中的级联值 [英] Cascading values in edit popup in jqgrid using database
问题描述
Iam使用JqGrid显示值
编辑detials时,我需要在弹出窗口中的selectbox中显示级联值。 br />
我尝试使用编辑选项URL和构建选择,但我不知道如何根据以前的值设置级联。
我需要使用数据库,而不是本地数据。
改变它的工作正常,我需要同样最初显示弹出窗口< br $> b $ b
我尝试过:
editoptions:{
dataUrl:$(#ZoneMaster_GetDistricts)。val(),
dataInit:function(elem){
$(elem).width(165) ;
},
buildSelect:function(data){
var response = jQuery.parseJSON(data);
var s ='< select>';
for(var i = 0;我< response.length; i ++){
s + ='< option value ='+ response [i] [DistrictId] +'>'+ response [i] [DistrictName] +'< ; / option>';
}
返回s +< / select>;
},
Iam Using JqGrid to show the values
While editing the detials , I need to show cascading values in selectbox in popup.
I tried by using edit options URL and build select, but Iam not able to know how to set cascading based on previous values.
I need to do it using database, not local data.
On change its working fine, I need the same initially displaying the popup
What I have tried:
editoptions: {
dataUrl: $("#ZoneMaster_GetDistricts").val(),
dataInit: function (elem) {
$(elem).width(165);
},
buildSelect: function (data) {
var response = jQuery.parseJSON(data);
var s = '<select>';
for (var i = 0; i < response.length; i++) {
s += '<option value="' + response[i]["DistrictId"] + '">' + response[i]["DistrictName"] + '</option>';
}
return s + "</select>";
},
推荐答案
(#ZoneMaster_GetDistricts)。val(),
dataInit:function(elem){
("#ZoneMaster_GetDistricts").val(),
dataInit: function (elem) {
(elem).width(165);
},
buildSelect:function(data){
var response = jQuery.parseJSON(data);
var s ='< select>';
for(var i = 0; i< response。长度; i ++){
s + ='< option value ='+ response [i] [DistrictId] +'>'+ response [i] [D istrictName] +'< / option>';
}
返回s +< / select>;
},
(elem).width(165);
},
buildSelect: function (data) {
var response = jQuery.parseJSON(data);
var s = '<select>';
for (var i = 0; i < response.length; i++) {
s += '<option value="' + response[i]["DistrictId"] + '">' + response[i]["DistrictName"] + '</option>';
}
return s + "</select>";
},
jQuery(函数(
jQuery(function(
这篇关于使用数据库在jqgrid中编辑弹出窗口中的级联值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!