大佬教程收集整理的这篇文章主要介绍了整个 JqGrid 表正在缩小,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我的剃刀页面上有问题类型,其中包含三个选项:Options
、Value
和 Textual
。当我选择 Option 时,我希望 Jqgrid 出现。当问题类型已设置为选项时。 JqGrID 看起来不错,就像下面的照片一样。
@H_673_13@
但是当问题类型选择为 Textual
或 value
并且当我将其更改为 Options
时,错误发生了。表格会自动缩小。下图。
将 Textual
更改为 Option
,如下图。
Jqgrid 的代码:
function QuestionTypeChoice() {
if($("#dropdownQuestionType").val()=="Option")
{
$(".GrIDdiv").show();
}
else
{
$(".GrIDdiv").hIDe();
}
$("#tblSurveyOption").jqgrid({
mtype: "GET",url: "/Survey/GetSurveyOptions",datatype: "Json",async: false,postData: {
questionID: $('#SurveyQuestionsID').val(),},colnames: [
"ID","SurveyQuestionID","Sequence","Option","Description"
],colmodel: [
{ key: true,name: "SurveyOptionID",index: "SurveyOptionID",editable: false,hIDden: true },{ key: false,name: "SurveyQuestionID",index: "SurveyQuestionID",name: "Sequence",index: "Sequence",editable: true,wIDth: 10 },name: "OptionValue",index: "OptionValue",wIDth: 40 },name: "Description",index: "Description",wIDth: 50 },],pager: jquery("#divSurveyOption"),rowNum: -1,// scroll: 0,height: $(window).innerHeight() - 450,wIDth: '100%',vIEwrecords: true,caption: "Question List Options",emptyrecords: "No records",//footerrow: true,JsonReader: {
root: "rows",page: "page",@R_111_10586@l: "@R_111_10586@l",records: "records",repeatitems: false
},autowIDth: true,loadonce: false,//vIEwrecords: true,///newly added
grIDvIEw: true,//multiSELEct: false,//autoencode: true,onSELEctRow: function (ID,status,E) {},beforeProcessing: function (data,xhr) {},AJAXGrIdoptions: { cache: false },grIDComplete: function () { },ondblClickRow: function () { }
}).navGrID("#divSurveyOption",{ edit: false,add: true,del: true,search: false,refresh: false },{},{
// add options
zIndex: 100,url: "/Survey/CreateOption",mtype: 'Post',cloSEOnescape: true,closeAfteradd: true,wIDth: 400,reloadAftersubmit: true,serializeEditData: function (data) {
data["SurveyQuestionID"] = $("#SurveyQuestionsID").val();
return $.param(data);
},beforesubmit: function (posdata,obj) {
if ($('#Sequence').val() == '' || $('#Sequence').val() == undefined) {
return [false,"Please enter a sequence"];
}
else if ($('#OptionValue').val() == '' || $('#OptionValue').val() == undefined) {
return [false,"Please enter a option"];
}
else if ($('#Description').val() == '' || $('#Description').val() == undefined) {
return [false,"Please enter a description"];
}
else if (checkSequence(posdata.SequencE)) {
return [false,"Sequence number already exists"];
}
else {
return [true,""];
}
},afterComplete: function (responsE) {
if (response.responseText) {
var issuccess = response.responseText.split('~')[0];
if (issuccess == '1') {
toastr.success(response.responseText.split('~')[1]);
} else {
toastr.error(response.responseText.split('~')[1]);
}
}
}
},{
// delete options
zIndex: 100,url: "/Survey/deleteOption?questionID=" + $('#SurveyQuestionsID').val(),closeAfterdelete: true,recreateForm: true,msg: "Are you sure you want to delete this?",afterComplete: function (responsE) {
if (response.responseText) {
var issuccess = response.responseText.split('~')[0];
if (issuccess == '1') {
toastr.success(response.responseText.split('~')[1]);
} else {
toastr.error(response.responseText.split('~')[1]);
}
}
}
});
ReloadoptionGrID();
}
function checkSequence(sequencE) {
var data = $("#tblSurveyOption").jqgrid("getCol","Sequence");
if (data != null && data.length > 0 && data.indexOf(sequencE) != -1) {
return true;
}
else {
return false;
}
}
function ReloadoptionGrID() {
$("#tblSurveyOption").jqgrid('clearGrIDData');
//Reload grID trigger
$("#tblSurveyOption").setGrIDParam(
{
url: "/Survey/GetSurveyOptions" + "?questionID=" + $('#SurveyQuestionsID').val()
}).trigger("reloadGrID");
}
$body.off('click','#SaveSurveyQuestion');
$body.on('click','#SaveSurveyQuestion',function (E) {
e.preventDefault();
var value = $('#Questiontext').val();
if (value == "" || value == undefined) {
toastr.warning("Question cAnnot be empty.");
return;
}
SaveQuestion();
});
Razor 页面中的代码:
<div class="row table-responsive">
<div class="col-md-12">
<div class="row">
<div class="col-md-12">
<div class="GrIDdiv">
<table ID="tblSurveyOption"></table>
<div ID="divSurveyOption"></div>
</div>
</div>
</div>
</div>
</div>
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的整个 JqGrid 表正在缩小全部内容,希望文章能够帮你解决整个 JqGrid 表正在缩小所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。