2
私は最初の列にハイパーリンクである番号があるjqgridを持っています。 クリックすると、formatter:linkfmatter
が使用され、ajax呼び出しを使用してROWIDがバックエンドに送信されます。コラムB
が0であれば別の列の値に基づいてjqgridのハイパーリンクを無効にする
は今私の要件は、特定の行の列B
iが列B
ハイパーリンクを無効にすることにしたい1であるとき、私は列A
がハイパーリンクになりたいけどです。
誰かがjavascript-jqueryを使用して可能なことを教えて、正しい方向に向けることができますか? はここjqgrid
$("#tblJQGridCCVT").jqGrid({
url: "@Url.Action("MyAction", "MyController")" + "?Parameters=" + Params + "",
datatype: "json",
mtype: 'GET',
cache: false,
async: false,
colNames: ['A', 'B', 'C', 'D', 'E','F', so on...],//nearly 30 columns
colModel: [
{ name: 'A', index: 'A', width: 150, edittype: 'select', formatter: linkFmatter },
{ name: 'B', index: 'B', width: 150 },
{ name: 'C', index: 'C', width: 150 },
{ name: 'D', index: 'Updated By', width: 150 },
{ name: 'E', index: 'E', width: 150 },
{ name: 'F', index: 'F', width: 150 },
So on
...
...
...
],
pager: $('#pager'),
height:300,
rowNum: 10,
sortorder: "desc",
sortname: 'ResponseId',
viewrecords: true,
sortable: true,
loadonce: true,
forceClientSorting: true,
ignoreCase: true,
caption: "Summary"
});
$("#tblJQGridCCVT").jqGrid('navGrid', '#pager', { view: false, del: false, add: false, edit: false, search: true, refreshtext: "Refresh" }, { closeOnEscape: true, multipleSearch: true, closeAfterSearch: true }, {}, {}, {});
$("#tblJQGridCCVT").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false, defaultSearch: 'cn' });
function linkFmatter(cellvalue, options, rowObject) {
var selectedCellValue = cellvalue;
var selectedRowId = options.rowId;
return '<a href="javascript:MethodJS(' + selectedRowId + ')" style="color: #3366ff" id="' + selectedRowId + '" >' + selectedCellValue + '</a>';
}
function MethodJS(selectedRowId) {
$.ajax({
async: false,
type: "POST",
contentType: "application/json; charset=utf-8",
url: "@Url.Action("GetDetailedViewOfResponsesForEdit", "ViewResponseDetailsCCVT")",
data: "{RowId:'" + selectedRowId + "'}",
success: function (Result) {
if (Result == "Success") {
var url = window.location.href;
window.location.href = "@Url.Action("ResponseDetailsEditForCCVT", "ViewResponseDetailsCCVT")";
}
}
});
}