C# MVC 4,JTTable 2.3,表格数据为';t在第二次(+;)调用时重建
第一个表上的选择将导致第二个表中的更改。但是,更改只发生一次。任何后续调用都会生成有效的JSON,但html保持不变 控制员:C# MVC 4,JTTable 2.3,表格数据为';t在第二次(+;)调用时重建,c#,jquery,asp.net-mvc,jquery-ui,jtable,C#,Jquery,Asp.net Mvc,Jquery Ui,Jtable,第一个表上的选择将导致第二个表中的更改。但是,更改只发生一次。任何后续调用都会生成有效的JSON,但html保持不变 控制员: [HttpPost] public JsonResult M1List(int jtStartIndex, int jtPageSize, string jtSorting) { try { List<tblM> m1 = new DataHelper().GetM1(jtSorting
[HttpPost]
public JsonResult M1List(int jtStartIndex, int jtPageSize, string jtSorting)
{
try
{
List<tblM> m1 = new DataHelper().GetM1(jtSorting, jtPageSize, jtStartIndex);
int m1Count = new DataHelper().Getm1Count();
return Json(new { Result = "OK", Records = m1, TotalRecordCount = m1Count });
}
catch (Exception ex)
{
return Json(new { Result = "ERROR", Message = ex.Message });
}
}
[HttpPost]
public JsonResult M2List(int mId, int jtStartIndex, int jtPageSize)
{
try
{
List<ViewM1A> m2 = new DataHelper().GetM2ForM1(mId.ToString(), "mId", jtPageSize, jtStartIndex);
int m2Count = new DataHelper().GetM2ForM1Count(mId.ToString());
return Json(new { Result = "OK", Records = m2, TotalRecordCount = m2Count });
}
catch (Exception ex)
{
return Json(new { Result = "ERROR", Message = ex.Message });
}
}
html:
<div id="m1TC"></div>
<div id="m2TC"></div>
通过在“var record=$(this).data(“record”);”之后添加此代码解决:
$('#m2TC')。删除();
$('#m1TC')。在('')之后;
<div id="m1TC"></div>
<div id="m2TC"></div>
$('#m2TC').remove();
$('#m1TC').after('<div id="m2TC"></div>');