0
votes

I have a problem when I bind the data store from the data model in the model I get responses that I have sent when I want to set the data in the grid error Cannot use bind config without a viewModel

in the items section I have also added itemconfig: { viewModel: true } but it still doesn't work and and in view already require controller and model

items: [{
                                                    xtype: "formpanel",
                                                    autoScroll: true,
                                                    items: [{
                                                        itemConfig: {
                                                            viewModel: true
                                                        },
                                                        hideHeaders: true,
                                                        xtype: 'grid',
                                                        height: "200px",
                                                        bind:{
                                                            store:"{approval_capital_appropriation_request}"
                                                        }, 
                                                        columns: [{
                                                            dataIndex: "field",
                                                            text: "field",
                                                            width: "130px"
                                                        }, {
                                                            dataIndex: "value",
                                                            text: "value",
                                                            width: "300px"
                                                        }]
                                                    }]
                                                }]
1
I recommend a fiddle showing the problem - mcg1103

1 Answers

0
votes

Please assign viewModel class like

 viewModel: 'main'
*************************************
Ext.define('SenchaApp.view.main.List', {
    extend: 'Ext.grid.Panel',
    xtype: 'mainlist',

    requires: [
        'SenchaApp.store.Personnel',
        'SenchaApp.view.FilterCombo'
    ],
    plugins: 'gridfilters',
    title: 'Personnel',
    viewModel: 'main',
    bind:{
        store:'{personnel}'
    },
    columns: [
        { text: 'Name',  dataIndex: 'name',
        filter:{
            type:'filterCombo'
        }
     },
        { text: 'Email', dataIndex: 'email', flex: 1 },
        { text: 'Phone', dataIndex: 'phone', flex: 1 }
    ],

    listeners: {
        select: 'onItemSelected'
    }
});
Here is model
**********************
Ext.define('SenchaApp.view.main.MainModel', {
    extend: 'Ext.app.ViewModel',

    alias: 'viewmodel.main',

  stores:{
    personnel:{
       //TODO -*********
    }
  }

    
});