【发布时间】:2019-02-21 00:36:24
【问题描述】:
我正在尝试修改和现有的 jqGrid,它通过 C# MVC 中的模型显示数据,但我不能只显示来自一个模型的数据,我必须从多个模型中检索和显示数据,所以我使用视图模型而不是模型,但没有填充数据。
之前: createReferralGrid = function (parentRowId, referrals, studentId, testDate) {
$grid.jqGrid({
sg_blankRowOnAdd: !_readOnly,
sg_blankRowData: blankRow,
cmTemplate: { sortable: false, title: false, fixed: true },
data: referrals,............
colModel: [
{
name: 'ReferralCode',
index: 'ReferralCode',
width: 105,
formatter: function (cellvalue, options, rowObject)
之后: createReferralGrid = function (parentRowId, rowData, studentId, testDate) {
$grid.jqGrid({
sg_blankRowOnAdd: !_readOnly,
sg_blankRowData: blankRow,
cmTemplate: { sortable: false, title: false, fixed: true },
data: rowData,
datatype: "local",
height: "auto",....
colModel: [
{
name: 'Referrals.ReferralCode',
index: 'Referrals.ReferralCode',
width: 105,
formatter: function (cellvalue, options, rowObject)
注意:Referrals 是 rowData 中的一个模型,之前我只传递了引荐,所以它可以工作,但现在我传递了 viewmodel(rowData),我在 colModel 中使用了 rowData.ReferralCode,然后它就不起作用了
【问题讨论】:
标签: jquery asp.net-mvc jqgrid viewmodel jqgrid-asp.net