为什么每次调用“show()"时我的 JqGrid 都会缩小? [英] Why my JqGrid shrinks every time when I call 'show()'?
问题描述
每次我从总共包含三个选项(OPTION、TEXTUAL)的下拉菜单中选择OPTION时,我都试图在页面上显示一个JqGridstrong> 和 VALUE).我正在使用 show
和 hide
以便我至少可以在用户在该页面上的时间内保存用户输入的值.当页面加载并在下拉菜单中选择了 OPTION 时,即使切换到其他选项导致表格隐藏,然后返回到 OPTION,表格也能正常显示和工作,它仍然工作正常.当我使用选定的选项 TEXTUAL 或 VALUE 加载页面时,就会出现问题.当我将选项更改为 OPTION 时,它会缩小我的 jqGrid.当我通过从工具栏中选择它来移动 chrome 浏览器时,它会自动修复它.
<div class="col-md-12"><div class="row"><div class="col-md-12"><table id=OptionTable"></table><div id="divOptionTable"></div>
隐藏和显示 jqGrid 的脚本
if($("#dropdownmenu").val()=="Option"){$(".jqGrid").show();}别的{$(".jqGrid").hide();}});
我的 JQGrid 代码:
$("#OptionTable").jqGrid({mtype:GET",网址:---网址---",数据类型:json",异步:假,列名:[col0"、col1"、col2"],颜色型号:[{ key: true, name: "col0", index: "col0", editable: false, hidden: true },{ key: false, name: "col1", index: "col1", editable: false, hidden: false },{ key: false, name: "col2", index: "col1", editable: false, hidden: true }],寻呼机:jQuery(#divOptionTable"),行数:-1,滚动:0,高度:$(window).innerHeight() - 450,宽度: '100%',观看记录:真实,标题:---标题---",emptyrecords: "无记录",jsonReader:{根:行",页面:页面",总计:总计",记录:记录",重复项:假},自动宽度:真,加载一次:假,网格视图:真实,多选:假,onSelectRow: 函数 (id, status, e) {},beforeProcessing:函数(数据,状态,xhr){},ajaxGridOptions:{缓存:假},网格完成:函数(){},ondblClickRow: 函数 () { }});
收缩是什么意思:
$("#tblSurveyOption").jqGrid('setGridWidth', $(window).innerWidth());
我不知道可能有错误.我在 JQGrid 函数的末尾使用了这个函数,效果很好.
I am trying to show a JqGrid on page every time I choose OPTION from the dropdown menu which consist of total three options(OPTION,TEXTUAL and VALUE). I am using show
and hide
so that I can hold the value entered by the user at least for the time he is on that page. When the page loads with OPTION already selected on the dropdown menu then the table is showing and working fine, even after switching to other options which results in hiding of table and then making it back to OPTION, still it is working fine.
The issue comes when I the page loads with selected option TEXTUAL or VALUE. When I change the option to OPTION it shrinks my jqGrid. And when I move chrome browser by selecting it from Toolbar, then it automatically fixes it.
<div class="row table-responsive">
<div class="col-md-12">
<div class="row">
<div class="col-md-12">
<div class="jqGrid" style="display:block">
<table id="OptionTable"></table>
<div id="divOptionTable"></div>
</div>
</div>
</div>
</div>
</div>
Script to hide and show jqGrid
if($("#dropdownmenu").val()=="Option")
{
$(".jqGrid").show();
}
else
{
$(".jqGrid").hide();
}
});
MY JQGrid code:
$("#OptionTable").jqGrid({
mtype: "GET",
url: "---url---",
datatype: "json",
async: false,
colNames: [
"col0", "col1", "col2"
],
colModel: [
{ key: true, name: "col0", index: "col0", editable: false, hidden: true },
{ key: false, name: "col1", index: "col1", editable: false, hidden: false },
{ key: false, name: "col2", index: "col1", editable: false, hidden: true }
],
pager: jQuery("#divOptionTable"),
rowNum: -1,
scroll: 0,
height: $(window).innerHeight() - 450,
width: '100%',
viewrecords: true,
caption: "---caption---",
emptyrecords: "No records",
jsonReader: {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false
},
autowidth: true,
loadonce: false,
gridview: true,
multiselect: false,
onSelectRow: function (id, status, e) {},
beforeProcessing: function (data, status, xhr) {},
ajaxGridOptions: { cache: false },
gridComplete: function () { },
ondblClickRow: function () { }
});
By shrink this is what is mean:
$("#tblSurveyOption").jqGrid('setGridWidth', $(window).innerWidth());
I don't know there is a bug may be. I used this function at the end of JQGrid function and this works fine.
这篇关于为什么每次调用“show()"时我的 JqGrid 都会缩小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!