public ActionResult GetDictTypes()
{
var data = from a in dbo.DictTypes
select new DictTypeListViewModel
{
ID = a.ID,
Name = a.Name,
LastChangeUser = a.LastChangeUser,
LastChangeDate = a.LastChangeDate,
Remark = a.Remark
};
return Json(data.ToList());
}
<table class="table" id="DictTypeTable"> <thead> <tr> <th>ID</th> <th>标题</th> <th>简介</th> </tr> </thead> <tbody class="sel"></tbody> </table>
function ShowDictType() {
$('#DictTypeTable').children('tbody').empty();
$.ajax({
url: GetDictTypes_URL,
type: 'post',
dataType: 'json'
})
.done(function (data) {
var tbody = "";
$.each(data, function (index, el) {
var tr = "<tr>";
tr += "<td>" + el.ID + "</td>";
tr += "<td>" + el.Name + "</td>";
tr += "<td>" + el.Remark + "</td>";
tr += "</tr>";
tbody += tr;
});
$('#DictTypeTable').children('tbody').append(tbody);
BindDictTypeTableEvent();//这里是绑定事件
})
.fail(function () {
alert("Err");
});
}
function BindDictTypeTableEvent() {
$('#DictTypeTable tbody.sel').children('tr').click(function (event) {
$(this).siblings('tr').removeClass('active');//删除其他行的选中效果
$(this).addClass('active');//增加选中效果
var id = $(this).children('td:eq(0)').text();//获取ID
ShowDictData(id);//操作代码,这里是显示另一个表格数据
});
}
function GetTypeTableSelectId() {
return $('#DictTypeTable tbody.sel tr.active td:eq(0)').text();
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有