Sencha Grid scroll 추가

2024. 11. 26. 22:07Javascript/Sencha

scrollable: true

Ext.create('Ext.grid.Panel', {
    renderTo: Ext.getBody(),
    title: 'Scrollable Grid Example',
    width: 800,
    height: 400, // Set a fixed height to make scrolling effective
    scrollable: true, // Enable scrolling
    store: Ext.create('Ext.data.Store', {
        fields: ['id', 'name', 'email'],
        data: (function () {
            // Generate sample data
            let data = [];
            for (let i = 1; i <= 100; i++) {
                data.push({
                    id: i,
                    name: 'User ' + i,
                    email: 'user' + i + '@example.com'
                });
            }
            return data;
        })()
    }),
    columns: [
        { text: 'ID', dataIndex: 'id', flex: 1 },
        { text: 'Name', dataIndex: 'name', flex: 2 },
        { text: 'Email', dataIndex: 'email', flex: 3 }
    ]
});