【问题标题】:dojox.grid.DataGrid How to add an input field and restrict input sizedojox.grid.DataGrid 如何添加输入字段并限制输入大小
【发布时间】:2013-10-06 00:16:15
【问题描述】:

我希望在 dojo 数据网格中添加一个输入字段。我环顾四周,但 没找到。

我可以使它工作的唯一方法是使单元格可编辑。

这使得该单元格表现为输入字段,但我该如何限制 可以输入多少文本或字符说我想限制 该单元格只能容纳 20 个字符。我该怎么做。

有什么建议吗?

【问题讨论】:

    标签: dojo dojox.grid.datagrid


    【解决方案1】:

    首先,dojox.grid.DataGrid 是旧的,将来可能会弃用。 Dojo 开发人员建议改用dgridgridx。见this ticket

    回到 DataGrid,您可以尝试创建输入字段:

    {
        field      : 'fieldName',
        name       : "labelName",
        editable   : true,
        type       : dojox.grid.cells._Widget,
        formatter  : function(){
           return new dijit.form.ValidateTextBox({  //or any kind of Textbox you want
                // put any customize at here  
           });
        }
    }
    

    通过使用格式化程序,您可以在此处使用任何类型的 dijit。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-31
      • 2015-02-04
      • 2012-04-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多