Javascript 如何使用其他模板覆盖colmodel

Javascript 如何使用其他模板覆盖colmodel,javascript,asp.net,asp.net-mvc,jqgrid,free-jqgrid,Javascript,Asp.net,Asp.net Mvc,Jqgrid,Free Jqgrid,免费jqgrid colmodel是在web应用程序中使用可选模板和以下属性定义的 {"template": defaultNumberTemplate, ,"label":"Price","name":"Price","width":53, "index":"Price","hidden":false } 在某些站点,colum模型需要特殊定制。对于此特殊模板,在站点js文件中定义如下 var newOrderPriceTemplate = { search : fa

免费jqgrid colmodel是在web应用程序中使用可选模板和以下属性定义的

{"template": defaultNumberTemplate,
   ,"label":"Price","name":"Price","width":53,
   "index":"Price","hidden":false
  }
在某些站点,colum模型需要特殊定制。对于此特殊模板,在站点js文件中定义如下

var newOrderPriceTemplate = {
    search : false,
    align: "center",
    sortable : false,
    label: "Special price", // overrides colmodel
    viewable : false,
    formatter: "showlink",
    formatoptions: {
        onClick: newOrderClick
    }
};
如何将此模板应用于colmodel?是否可以在commodel和add中使用特殊属性,如
overrideTemplate

  overrideTemplate: newOrderPriceTemplate
去colmodel还是其他什么想法


ASP.NET MVC4、Razor、Bootstrap 4也与jqrid一起使用

你不能。模板作为
colModel
属性的默认值集引入。默认值无法更改明确指定的
colModel
中的值


例如,如果要更改具有特定条件的
colModel
的所有项的
formatoptions
,则应枚举
colModel
的项,测试这些条件并将其覆盖为新值。

您不能。模板作为
colModel
属性的默认值集引入。默认值无法更改明确指定的
colModel
中的值


例如,如果要更改具有某些特定条件的所有
colModel
项的
formatoptions
,则应枚举
colModel
项,测试这些条件并将其覆盖为新值。

newOrderPriceTemplate
是简单的javascript独立对象。也许可以使用
$.extend(true,colModel[i],newOrderPriceTemplate)
之类的东西来设置
newOrderPriceTemplate
对象中的值,然后在colModel中解析主模板和内联属性?@Andrus:是的,您可以在代码中执行此操作,但这样的代码肯定不是部分,应该使用现成的免费jqGrid。您可以编写更符合您的需求和设置的代码,您计划在
newOrderPriceTemplate
中使用
newOrderPriceTemplate
是一个简单的javascript独立对象。也许可以使用
$.extend(true,colModel[i],newOrderPriceTemplate)
之类的东西来设置
newOrderPriceTemplate
对象中的值,然后在colModel中解析主模板和内联属性?@Andrus:是的,您可以在代码中执行此操作,但这样的代码肯定不是部分,应该使用现成的免费jqGrid。您可以编写更符合您的要求的代码,以及您计划在
neworderpricemplate
中使用的设置。