小编Ole*_*leg的帖子

JQGrid:子网格作为带有导航栏的 GRID

我正在使用 JQGrid 并将 subGrid 显示为 JQGRID 本身。我想知道是否有办法也显示子网格的导航栏。

我尝试按照它为 JQGrid 所做的方式进行操作,但徒劳无功。

提前致谢!

jqgrid subgrid

1
推荐指数
1
解决办法
4279
查看次数

jqGrid获取了json,但是有空行且没有数据

JSON由Spring 3 MVC @ResponseBody生成

{
    "total": "1",
    "page": "1",
    "records": "2",
    "rows": [
        {
            "id": "1",
            "cell": {
                "accountId": 1,
                "userId": 1,
                "transactionId": 6,
                "subCatId": 0,
                "accountName": "Credit Card",
                "remarks": "Movie Hall Pass",
                "amount": 250.0,
                "transactionDate": "2011-03-16",
                "subCatName": "Entertainment"
            }
        },
        {
            "id": "2",
            "cell": {
                "accountId": 2,
                "userId": 1,
                "transactionId": 7,
                "subCatId": 1,
                "accountName": "Savings Bank",
                "remarks": "Part at Besand Nagar",
                "amount": 5000.0,
                "transactionDate": "2011-03-16",
                "subCatName": "Dine Out"
            }
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

JQGrid初始化代码:

$("#transactionLogTable").jqGrid({
                url: '/et/transaction/getTransactions?dateValue=03%2F16%2F2011',
                datatype: "json",
                loadError: …
Run Code Online (Sandbox Code Playgroud)

model-view-controller jquery spring json jqgrid

1
推荐指数
1
解决办法
6883
查看次数

jqgrid过滤器在加载时删除一行

我使用jqgrid构建了一个网格,并启用了过滤功能.检索的数据类型是json,我正在使用loadonce功能.当我应用一些过滤器时,它似乎总是隐藏在记录上.我正在使用网格寻呼机只是为了拥有我想在网格上添加的额外按钮,我正在删除gridpager按钮(下一个,最后一个等等).我删除了寻呼机,看看是否有任何冲突,但我仍然得到同样的错误.当网格加载时我得到'View 1 - 7 of 7'并且我可以看到7条记录,当我应用过滤器时,输出是'View 1 - 3 of 4'.这意味着4条记录与过滤器匹配,但它只保持显示3.现在如果我清除过滤器,我得到"查看1 - 6的7",再次丢失一条记录.我用firebug检查了表,看看记录是否隐藏但仍然没有.我尝试了firefox,chrome,IE,在所有浏览器中我都得到了同样的错误.jqgrid版本是4.1.1.任何线索为什么会发生这种情况?

您可以在下面看到代码:

jq($grid).jqGrid({
    url: $url,
    datatype: 'json',
    mtype: 'Get',
    colNames: colNamesList,
    colModel: $colModel,
    jsonReader : {
        repeatitems:false,
        id: "id",
    },
    rowNum: -1, 
    width: jq(document).width()-20,
    height: 200,
    pager: $pagerId,
    viewrecords: true,
    fixed: true,
    shrinkToFit: false,
    loadonce: true, 
    caption: $caption,
    beforeRequest: function(){
        if (!initialized) {
            jq(blockElement).block({ message: '<h1 class="loadingMsg">Grid is loading, please wait...</h1>' });
        }
    },
    loadComplete: function(data){
        if (loadCompleteCallback != null){
            loadCompleteCallback(data);
        }

        if (!initialized) {
            jq.jGrowl('"' + $caption …
Run Code Online (Sandbox Code Playgroud)

jquery filter jqgrid

1
推荐指数
1
解决办法
2073
查看次数

网格加载时在特定字段上对jqgrid进行默认排序

我想加载一个默认排序的网格,它是一个字段.我通过向网格添加sortname和sortorder来完成此操作,但是当网格加载时,排序符号显示在该字段的标题上.但是当我单击分页下一个按钮而不是网格加载时,记录将被排序.

有谁知道它为什么不对电网负载进行排序?

@UPDATE:嗨,我正在使用我的数据类型作为XML和我的配置.如下:

jQuery("#userList").jqGrid({
    url: '<%=request.getContextPath()%>/userJqGrid?q=1&action=fetchData&userCookie=<%= encodedCookie%>',
    datatype: 'xml',
    mtype: 'GET',
    colNames:['<%= userProp.getProperty(userColNames[0])%>',
              '<%= userProp.getProperty(userColNames[1])%>',
              '<%= userProp.getProperty(userColNames[2])%>',
              '<%= userProp.getProperty(userColNames[3])%>',
              '<%= userProp.getProperty(userColNames[4])%>',
              '<%= userProp.getProperty(userColNames[5])%>'
    ],
    colModel:[
        {name:'<%= userColNames[0]%>',index:'<%= userColNames[0]%>',
            width:120,sortable:true,editable:true,editrules:{required:true},formoptions:{rowpos:1, elmprefix:'*'}},
        {name:'<%= userColNames[1]%>',index:'<%= userColNames[1]%>',
            width:130,sortable:true,editable:true},
        {name:'<%= userColNames[2]%>',index:'<%= userColNames[2]%>',
            width:100,sortable:true,editable:true,editrules:{required:true},formoptions:{rowpos:3, elmprefix:'*'}},
        {name:'<%= userColNames[3]%>',index:'<%= userColNames[3]%>',
            width:180,sortable:true,editable:true,editrules:{email:true,required:true},formoptions:{rowpos:4, elmprefix:'*'}},
        {name:'<%= userColNames[4]%>',index:'<%= userColNames[4]%>',
            width:100,sortable:true,editable:true},
        {name:'<%= userColNames[5]%>',index:'<%= userColNames[5]%>',
            width:100,sortable:true,editable:true},
    ],
    pager:'#pager1',
    rowNum:'<%=appProp.getProperty("per_page_records")%>',
    height:'auto',
    viewrecords:true,
    loadonce:true,
    sortable:true,
    width:'100%',
    gridview: true,
    autowidth:true,
    shrinkToFit:false,
    ignoreCase:true,
    editurl:'<%=request.getContextPath()%>/userJqGrid?q=1&action=addData&userCookie=<%=encodedCookie%>',
    caption: 'User Records',
    sortname:'<%=userColNames[14]%>',
    sortorder:'asc',
    onSelectRow: function (id){
        checkAndSetCookie();
    },
    onSortCol : function(){
        checkAndSetCookie(); …
Run Code Online (Sandbox Code Playgroud)

jqgrid

1
推荐指数
1
解决办法
4385
查看次数

jqGrid:searchoptions中的dataUrl不能与jqGrid4.4.5一起使用

我有点困在jqgrid中的searchoptions属性.当我点击网格中的搜索图标并使用'下拉列表'遍历该字段时,我会在firefox和IE8中看到以下错误

FF:TypeError:gjquery.jqGrid.min.js中未定义(第239行)

IE:消息:'postData'为null或不是对象Line:238

以下是代码段,

  {name:'City', index:'City', width:80, align:'right', 
   editable: true,search:true,edittype: 'select',stype:'select',
   searchoptions: {
     ajaxSelectOptions: {type: "GET",datatype:"text"},
     dataUrl:  '/TESTAPP/Test',          
     dataEvents: [
             {  type: 'change',
                fn: function(e) {
                  alert(this.value)
              }
             } 
          ]}
Run Code Online (Sandbox Code Playgroud)

我甚至没有看到请求命中服务器,这是非常奇怪的.

PS:同样适用于editoptions

版:

jqGrid:4.4.5

jquery:1.9.1

谢谢你的帮助!

jquery jqgrid

1
推荐指数
1
解决办法
3058
查看次数

如何将jqGrid的编辑形式的位置设置为窗口的中心

我有jqGrid与编辑和添加表单,问题是显示jqGrid的左侧,而不是窗口的中心,我尝试了不同的方式,但没有得到,这里我的代码是..

$(document).ready(function () {
    jQuery("#jQGridDemo").jqGrid({
        url: 'http://localhost:52618/Sample/GetEmployeeDetails',
        datatype: "json",
        mtype: "POST",
        colNames: ['Eno', 'Ename', 'City', 'Salary', 'Address', 'Actions'],
        colModel: [
         { name: 'Eno', index: 'Eno', width: 120, stype: 'text', height: 90, editable: true },
         { name: 'Ename', index: 'Ename', width: 150, editable: true },
         { name: 'City', index: 'City', width: 150, editable: true },
            { name: 'Salary', index: 'Salary', width: 100, height: 120, editable: true },
            { name: 'Address', index: 'Address', width: 100, height: 120, hidden: true, editable: true, editrules: …
Run Code Online (Sandbox Code Playgroud)

jquery jqgrid

1
推荐指数
1
解决办法
5184
查看次数

jquery datepicker不使用.serialize()发送数据来填充网格

我有一个表单,其中包含2个输入类型="文本",1个组合框和其他包含(组合框包含等于,之后,之前和之间的运算符+开始日期(jquery datepicker)+结束日期(jquery日期选择器)但是当我是使用.serialize()将数据发送到服务器,并使用url将其附加日期参数.

我的方法:

$("form#transactionForm").submit(function() {
    var newUrl = "/cpsb/transactionHistory.do?method=getTransactionHistoryDetails&" +
                 $(this).serialize();

    $("#transactionHistory").jqGrid(
        "setGridParam",
        {"url": newUrl, datatype:"json"}).trigger("reloadGrid");
    return false;
});
Run Code Online (Sandbox Code Playgroud)

标记:

<form class="transform" id="transactionForm" method="post" action="">
    <fieldset class="ui-widget ui-widget-content ui-corner-all">
        <legend class="ui-widget ui-widget-header ui-corner-all">Transaction History</legend>
        <p>
            <label for="lpn">LPN</label>
            <input id="lpn" name="lpn"/>
        </p>
        <p>
            <label for="sku">SKU</label>
            <input id="sku" name="sku" class="skui ui-widget-content" />
        </p>
        <p>
            <label for="ttype">Transaction Type:</label>
            <select id="ttype" name="tranType" >
            <option value="">Select transaction type</option>
            <option value="100">100-Receipt</option>
            <option value="110">110-Shipment</option>
            <option value="120">120-Pallet Update</option>
            </select>
        </p>
        <p>
            <label for="tdate">Transaction date:</label>
            <select id="tdate" name="date">
                <option …
Run Code Online (Sandbox Code Playgroud)

jquery serialization datepicker submit jqgrid

0
推荐指数
1
解决办法
3209
查看次数

jqgrid检索单元格的数据并对其进行操作

我想从dataEvents事件中检索用户输入的值.我想只允许数字0-24,如果用户插入一个像4,5(德语写作)的数字,我想用"."替换",".因此将"4,5"转换为"4.5".

但我正在努力获取用户输入的数据.我正在使用的方法总是返回空白.

colModel:[
    {name:'sum',index:'sum', width:45, editable: true, sortable:false,
     editoptions: { dataEvents: [ 
                        {
                            type: 'keypress', // keydown
                            fn: function(e) {
                                // console.log('keypress');
                                var v=$(e.target).text();
                                alert(v); // v is empty.
                                //reset the target value, actually I want to replace
                                // enter code here a comma with a point
                                // only allow the numbers 0 - 24
                            }
                        }
                    ] 
                  }
    },
],
Run Code Online (Sandbox Code Playgroud)

jquery jqgrid

0
推荐指数
1
解决办法
7820
查看次数

使用 Ajax 的 jqGrid 自定义编辑规则函数显示“自定义函数应该返回数组!”

我正在使用 jqGrid,最新版本,当我应用自定义函数的编辑规则并执行 ajax 时,它总是返回“自定义函数应始终返回一个数组”。我认为这是一个时间问题,所以我将 ajax 设置为 false 但仍然存在问题。任何人都有一个自定义函数,可以执行正常工作的 ajax 调用。感谢任何帮助。谢谢你。

jQuery(softwareReportingGrid.gridId).jqGrid({
    editurl: 'clientArray',
    datatype: 'json',
    colNames: ["Car"],
    colModel: [
        {"index":"Car","name":"Car","edittype":"text","editable":true,
            "editrules":{"custom":true,"custom_func":validateCar,"required":true}}
    ....
Run Code Online (Sandbox Code Playgroud)

我有以下 javascript 函数,它被称为

validateCar: function (value, colname) {
    jQuery.ajax({
        async: false,
        url: validateCarUrl,
        data: { carName: value },
        dataType: 'json',
        contentType: 'application/json; charset=utf-8',
        success: function (data) {
            if (data) {
                return [true, '']
            } else {
                return [false, value + ' is not a valid car'];
            }
        },
        error: function () { alert('Error trying to validate …
Run Code Online (Sandbox Code Playgroud)

javascript ajax jqgrid

0
推荐指数
1
解决办法
6890
查看次数