2016-01-22 50 views
0

我想使用內存存儲選擇器使用dgrid示例,我無法填充網格,我得到一個錯誤TypeError:renderedCollection.fetchRange不是一個功能。請指教,如何去做這個使用選擇器時Dgrid錯誤-renderedCollection.fetchRange不是一個函數

我編輯包括dstore /內存。在網格中加載數據仍然存在問題

require([ 
    'dojo/_base/declare', 'dgrid/Grid', 'dgrid/Selector', 'dstore/Memory' 
    ], function (declare, Grid, Selector, Memory) { 


/* jshint maxlen: 300 */ 
var dataList = [ 
    { col1: 'normal', col2: false, col3: 'new', col4: 'But are not followed by two hexadecimal', col5: 29.91, col6: 10, col7: false }, 
    { col1: 'important1', col2: false, col3: 'new', col4: 'Because a % sign always indicates', col5: 9.33, col6: -5, col7: false }, 
    { col1: 'importan2t', col2: false, col3: 'read', col4: 'Signs can be selectively', col5: 19.34, col6: 0, col7: true }, 
    { col1: 'note1', col2: false, col3: 'read', col4: 'However the reserved characters', col5: 15.63, col6: 0, col7: true }, 
    { col1: 'normal4', col2: false, col3: 'replied', col4: 'It is therefore necessary', col5: 24.22, col6: 5.50, col7: true }, 
    { col1: 'important', col2: false, col3: 'replied', col4: 'To problems of corruption by', col5: 9.12, col6: -3, col7: true }, 
    { col1: 'note', col2: false, col3: 'replied', col4: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris', col5: 12.15, col6: -4, col7: false } 
]; 


    var employeeStore = new Memory({data:dataList, idProperty: 'col1'}); 


// In 0.4, Selector already inherits Selection so you don't have to 
var grid = new (declare([ Grid, Selector ]))({ 
    collection: employeeStore, 
    columns: { 
     col1: 'Column1', 
     col2: 'Column 2' 
    } 
}, 'grid'); 

grid.startup(); 

});

回答

3

這看起來不太像dgrid的例子之一。您正在使用dojo/store/Memory,但dgrid 0.4+本機支持dstore,而不是dojo/store

dstore/Memory在功能上與dojo/store/Memory非常相似,所以您應該可以在沒有問題的情況下使用該示例。

+0

肯,我看着移植指南,我想我糾正了正確的包裝,仍然沒有填充網格。請諮詢 –

+0

我解決了這個問題。謝謝肯 –

相關問題