【问题标题】:igGrid column Edit TemplateigGrid 列编辑模板
【发布时间】:2014-11-13 15:40:45
【问题描述】:

igGrid 是否支持列编辑/新建模板?

我有一个定义如下的网格。但是在编辑/添加新行时模板将不起作用。 “ChooseEmployee”功能显示一个弹出对话框供用户选择员工。

$(function() {
  var employees = [{
    Id: 1,
    "Name": "John, Smith",
    "DirectReports": "Mary, Ann;David,Lowe"
  }, {
    Id: 2,
    "Name": "Mary, Ann",
    "DirectReports": "Kelly,Walsh;Kevin, Edwards;Terri, Gibson"
  }];
 
  $('#grid1').igGrid({
    dataSource: employees,
    primaryKey: "Id",
    autGenerateColumns: false,
    width: "100%",
    columns[{
      headerText: "Id",
      key: "Id",
      dataType: "number",
      width: 100
    }, {
      headerText: "Name",
      key: "Name",
      dataType: "string",
      width: 120
    }, {
      headerText: "Reports",
      key: "DirectReports",
      dataType: "object",
      width: 300,
      template: "<div style='clear:both'><div style='overflow:hidden;white-space:wrap;max-width:320px;width:320px;float:left;'>${DirectReports}</div><input type='button' onclick='chooseEmployees(${Id});' value='...' style='float:left;' /></div>"
    }], 
   features: [ {name: "Updating", enableAddRow: true, editMode: "row" } ] 
  });

});
&lt;table id="grid1"&gt;&lt;/table&gt;

【问题讨论】:

    标签: infragistics ignite-ui iggrid


    【解决方案1】:

    基本上,您必须取消 igGrid 正在执行的原始行编辑,并且必须以编程方式调用行更新和行添加。此模板也适用于已经存在的行,但在添加新行时不会应用。您可以尝试 igGrid 的行编辑模板功能,因为它在框编辑对话框中提供。如果您想从该特定列的值列表中进行选择,则可以为此列使用组合编辑器提供程序。

    Option for configuring editor provider for the column.

    updateRow API method.

    addRow API method.

    Setting up a row edit template.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-09-02
      • 1970-01-01
      • 2015-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多