Data backfill

Author: Old Cen
backfill must first bind the data in the database, and if there is no data how backfill?
So first we would bind the data in the database
public ActionResult SelectEmployee (LayuiTablePage layuiTablePage)
{
List <PW_Employee> ListEmployee = (from tbEmployee in myModel.PW_Employee
the OrderBy tbEmployee.employeeID Descending
the SELECT tbEmployee) .skip (layuiTablePage.GetStartIndex ())
.Take (layuiTablePage.limit) .ToList ();
int intTotalRow myModel.PW_Employee.Count = ();
layuiTableData <PW_Employee> layuiTableData new new layuiTableData = <PW_Employee> ()
{
COUNT = intTotalRow,
Data = ListEmployee
};
return Json (layuiTableData, JsonRequestBehavior .AllowGet);
}
only bind the database, it does not show up to the media, so we'll render the table
var tabemployee, layer, layuiTable;
blInsert = true;
$(document).ready(function () {
layui.use([‘layer’, ‘table’], function () {
layer = layui.layer, layuiTable = layui.table;
tabemployee = layuiTable.render({
cols: [[
{ title: ‘序号’, type: ‘numbers’ },
{ title: ‘员工编号’, field: ‘employeeNum’, align: ‘center’ },
{ title: ‘员工姓名’, field: ‘employeeName’, hide: true }, { title: ‘联系电话’, field: ‘telphone’, align: ‘center’ },
{ title: ‘家庭地址’, field: ‘address’, align: ‘center’ }, { title: ‘操作’, templet: setOperate, width: 160, align: ‘center’ }
]],
page: {
limit: 8,
limits: [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],
}
});
});
});
Finally, data can be backfilled, remember to reset the first form backfill.
openUpdate function (the employeeID) {
blInsert = to false;
$ ( "# formEmployee INPUT [type = 'RESET']") the Click ();. // reset the form
. $ ( "# modalEmployee .modal- header h6") text ( "modify employee information"); // modal form title text
$ ( "# modalEmployee") modal ();. // modal pop-up window
// modal form data backfill
$ .getJSON ( "/ Main / SelectEmployeeByID EmployeeID = "+ employeeID, function (the Data) {?
// get ID
$ (" # employeeID ") Val (data.employeeID);.
$ (" # employeeNum ") Val (data.employeeNum);.
$ ( "#employeeName") Val (data.employeeName);.
. $ ( "# Cellphone") Val (data.telphone);
$ ( "address #") Val (data.address);.
});
}
Here Insert Picture Description
This the data needed to backfill came

Guess you like

Origin blog.csdn.net/weixin_44541224/article/details/90286051