0

在我的 ruby​​ on rails 应用程序中,我有如下的 jquery 网格。根据 projectId,数据应显示在网格上。但它不是那样工作的。我观察到 url 没有根据 projectId 改变。

function editTeam_details(projectId)
{
    $("#grdProjectIdentification").jqGrid({

            url:'/project_identification_team?project_id='+projectId,

            colNames: ["Sr.No","Team Leader"],

            colModel: [
            {
                name: "Sr No",
                index: "Sr No",
                width: 15,
                align: "left",
                sortable:true
            },
            {
                name: "Team Leader",
                index: "Team Leader",
                width: 35,
                align: "left",
                sortable:false
            }],
    width: 800,
            height: 100,
            // Paging
            paging : true,
            toppager: true,
            loadonce : false,
            rowNum:20,
            rowList:[20,40,60],
            viewrecords: true,  
            pager: '#pagerProjectIdentification', 
            datatype: 'json',
            sortorder: "desc",
            multiselect: false,
            caption: "1. Project Identification"
        }).jqGrid("navGrid", "#pagerProjectIdentification", {
            edit: true,
            add: true,
            del: true,
            search: true,
            refresh: true
        },
        {}, // settings for edit
        {},
        {}, // settings for del
        {}, // settings for delete
        {
            sopt: ["cn"]
        } // Search options. Some options can be set on column level

        )
}
4

2 回答 2

0

你应该尝试更换

url:'/project_identification_team?project_id='+projectId

url: '/project_identification_team',
postData: {
    project_id: function () {
        return projectId;
    }
}

在这种情况下,project_id将通过在对服务器的每个请求上调用相应的函数来评估 URL 的参数值。有关更多详细信息,请参阅答案

于 2012-10-04T14:47:31.353 回答
0

谢谢你的回复,奥列格。

我尝试了以下方法,它奏效了。

$("#grdProjectIdentification").GridUnload(); ajaxGridOptions:{缓存:假}

于 2012-10-04T15:23:36.510 回答