使用局部視圖彈出,根據您的需求製作UI,並將行細節作爲模型傳遞給此局部視圖。
你的表HTML的樣子,
<tr id="@model.rowid">
<td>
sample
(<a onclick="RowDetails(@model.rowid)">Clickable</a>)
</td>
<td>
1/1/2012
</td>
<td>
</td>
</tr>
調用JavaScript功能上Clicktable喜歡的點擊,
function RowDetails(RowId) {
$("#divDetails").load('/yourController/rowdetail', { id: RowId }).dialog({
modal: true,
title: "Row Detail",
height: 400,
width: 600,
buttons: {
"Ok": function() {
var isComplete = 0;
if ($("#rowComplete").is(":checked")) { isComplete = 1; }
$.get("/yourController/RowComplete", { id: RowId, isChk: isComplete }, function (d) {
$("#" + RowId).before(d).remove();
$("#" + RowId).hide().fadeIn('slow');
});
$(this).dialog('close');
}
}
});
}
和控制器一樣,
public ActionResult rowdetail(int id)
{
// code to get row from databse
// return this row as object to partial view
return("partial view for row details", Object);
}
public ActionResult RowComplete(int id, int chk)
{
// code to update row from databse
// return this row as object
return("pass updated row", Object);
}
你簽出的jqGrid? http://trirand.net/default.aspx可能有你正在尋找的功能。 – 2012-04-05 16:31:50