2012-10-07 39 views
0
var pid = $('#byId').val(); 

jQuery("#patient").jqGrid({ 
    mtype: 'GET', 
    url : "totalPatientList.html", 
    postData :{pid:pid}, 
    datatype : "json", 
    colNames : [ 'Patient Id', 'Name', 'BirthDate', 'Address','City','Mobile' ], 
    colModel : [ { 
     name : 'patientId', 
     index : 'patientId', 
     width : 55 
    }, { 
     name : 'name', 
     index : 'name', 
     width : 200 
    }, { 
     name : 'birthdate', 
     index : 'birthdate', 
     width : 100, 
     editable : true 
    }, { 
     name : 'address', 
     index : 'address', 
     editable : true, 
     width : 80 
    }, { 
     name : 'city', 
     index : 'city', 
     editable : true, 
     width : 80 
    }, { 
     name : 'mobile', 
     index : 'mobile', 
     editable : true, 
     width : 80 
    } ], 
    rowNum : 10, 
    rowList : [ 5, 10, 30 ], 
    pager : '#pager', 
    sortname : 'id', 
    viewrecords : true, 
    sortorder : "desc", 
    caption : "Search Patient's List", 
    width : 800, 
    cellEdit : true, 
}); 

我有一個類似上面的代碼。如何從jsp頁面發送數據到控制器使用jqgrid在春天

我想從這個JSP頁面發送pid到controller.I得到pid,但是當我重新加載我的網頁時。當我點擊按鈕時,我不需要重新加載頁面。

我該怎麼做?

PLZ plz幫助我....

+0

AJAX它,你應該能夠做到這一點 – Satya

+0

@Satya我不想使用AJAX。我只想使用jQgrid在網格視圖中顯示數據。 – Balkrushn

+0

「我希望它無需重新加載頁面時,我點擊按鈕」 =阿賈克斯。 –

回答

0

您應該使用的postData「功能」的風格:

url: "totalPatientList.html", 
postData: { 
    pid: function() { 
     return $('#byId').val(); 
    } 
} 

在這種情況下的數值爲pid參數將被新的評估在每次請求到服務器。有關更多詳細信息,請參閱the answer。在這種方式下,您可以通過在postData對象中包含多個方法將多個參數發送到服務器。

相關問題