2014-06-08 31 views
3

我有两个KOgrid问题。KO Grid Scrollbars not visible&显示问题

1)我无法在kogrid中获得滚动条。在没有滚动条的情况下进行数据输入非常困难。

2)我也无法使kogrid工作,而没有指定硬编码的高度和宽度。在我的应用程序中,我不能有固定的高度和宽度。 其他人有同样的问题吗?

我试着从这个线程(使用jQuery修复作为我的viewmodel中的最后一行)的解决方法建议。 KO Grid Display Isseues, On resize Gird shows one row. Images also included

只是增加了网格的大小,但它没有显示任何数据。但是,当我调整页面数据显示。

下面是我的HTML和kogrid选项(我试过有和无分页选项,理想我不想使用分页)

<div data-bind="koGrid: gridOptions" 
    style="height: 800px; background-color: none;width: 1850px;"> 
    </div> 


    self.gridOptions = { 
     data: self.mydatarray, 
     footerVisible: true, 
     displaySelectionCheckbox: true, 
     afterSelectionChange: self.RowSelectionChange, 
     rowHeight: 50, 
     selectWithCheckboxOnly: true, 
     enableSorting: false, 
     multiSelect: true, 
     selectedItems: self.SelectedRows, 
     enableColumnResize: true, 
     showFilter: false, 
     canSelectRows: true, 
     enablePaging: true, 
     pagingOptions: { 
      currentPage: ko.observable(1), 
      pageSize: ko.observable(3), 
      pageSizes: ko.observableArray([3, 6, 9]) 

     }, 
     rowTemplate: errrowtmpl, 
     columnDefs: [ 
      { field: 'Customer', displayName: 'Customer', cellTemplate: Customersddedittmpl, headerCellTemplate: headercelltmpl }, 
       ... 
     ... 

      { field: 'GenNotes', displayName: 'GenNotes', cellTemplate: simpleedittmpl, headerCellTemplate: headercelltmpl } 
     ] 

    } 

请让我知道如果你需要更多的信息

谢谢

肯纳开发

回答

2

我找到了我遇到的问题的解决方案。

1)我用Jquery添加滚动条。我在下面添加了代码行,作为我的数据加载函数的最后一行。我不确定id是否会破坏其他KOGrid功能。在我的应用程序中,我做了一些基本的测试,看起来工作正常。

$("div.kgViewport").css("overflow", "scroll"); 

2)我仍然不知道如何解决这个问题的100%。除非固定宽度和高度在样式中提及,否则它仍然不起作用。在我的应用程序中,我使用了vw和vh,而不是固定的宽度和高度来解决使其适用于所有屏幕尺寸的问题。

<div data-bind="koGrid: gridOptions" 
    style="height: 73vh;overflow:scroll;width: 96vw;"></div>