【问题标题】:DataGrid shows strange Checkboxes below headingDataGrid 在标题下方显示奇怪的复选框
【发布时间】:2012-11-07 10:21:17
【问题描述】:

我在使用 dojo 显示 datagrid 时遇到问题。 使用ItemFileReadStore 提供的数据填充网格可以正常工作。但结果看起来像这样:

网格标题下方的两个checkboxes 不应该存在。我已经尝试过 DataGrid 的属性rowSelector,但我显然没有成功。

我以编程方式创建了DataGrid。这是源代码:

    var oStore = new dojo.data.ItemFileReadStore({
       data:{
          identifier: 'catID',
             items: [
                {catID: '3', duration: '1,5'},
                {catID: '4', duration: '2,0'},
                {catID: '9', duration: '1,0'},
                {catID: '7', duration: '2,0'}
             ]  
          }
       });

       var oGrid = new dojox.grid.DataGrid({
          store: oStore,
          query:{ catID:'*'},
          autoHeight: 5,
          structure:[
             {name: 'KatalogID', field: 'catID', width: 'auto'},
             {name: 'Dauer', field: 'duration', width: 'auto'}
          ]
       }, dojo.create('div', {'id':'oGrid'}));
       oGrid.startup();

有谁知道这些复选框来自哪里以及如何删除它们?

【问题讨论】:

    标签: javascript dojo dojox.grid.datagrid


    【解决方案1】:

    我找到了一个可能的解决方法,但这并不能解决问题: 包含以下 css 代码会隐藏包含不受欢迎的复选框的 div-container。

        <style type="text/css">
    
           .dojoxGridView > .dijitCheckBox{
              display: none; 
           }
    
        </style>
    

    不幸的是,这涉及到checkBoxes,它是由DataGrid-声明中的rowSelector-选项生成的。因此,如果您不需要 rowSeletion 功能(至少通过复选框),这可行。

    【讨论】:

      【解决方案2】:

      我多次遇到这个问题,通过包含 Grid.css 和主题 css 将其删除。这可以通过玩css来删除。

      【讨论】:

      • 嘿,不幸的是我已经包含了这 2 个 css 文件。没有它们,DataGrid 看起来与图片中的完全不同,而是像一张炸毁的桌子或其他东西。如果有人有任何其他想法,那就太好了,因为我将来可以在正确的地方使用这些复选框......
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-03-27
      • 2016-12-30
      • 1970-01-01
      • 1970-01-01
      • 2011-10-10
      • 2013-11-02
      • 1970-01-01
      相关资源
      最近更新 更多