Results 1 to 2 of 2

Thread: store method to load on admin dashboard template

  1. #1
    Sencha User
    Join Date
    Apr 2007
    Location
    Indonesia
    Posts
    31
    Answers
    3

    Default Answered: store method to load on admin dashboard template

    Dear Forums,

    i make an apps using admin dashboard template. i want to create pages with grid with cell editing features.
    but i got an error

    GET http://localhost/erte/build/producti...20150909030847 404 (Not Found)
    Uncaught TypeError: c is not a function

    sencha-err.jpg

    i analyze that this happen because store is not created before the view. and i had done my step bellow but not work.

    i had put in initcomponent in view
    Ext.create('Admin.store.GridList');

    but failed, i had changed into

    Ext.create('Admin.store.GridList',{}); also not work

    i had done to put into classic/src/view/main/ViewportController.js
    inject before Ext.create('Admin.view.'+view);

    but not lucky.

    i need advice.

    here is my view
    PHP Code:
    Ext.define('Admin.view.user.userGrid', {
        
    extend'Ext.grid.Panel',
        
    itemId'iduserGrid',
        
    id'iduserGrid',
        
    xtype'userGrid',
        
    alias'widget.userGrid',
        
    store'gridlist',
        
    controller'gridlist',
        
    requires: [
            
    'Ext.grid.plugin.CellEditing',
            
    'Ext.form.field.Text',
            
    'Ext.toolbar.TextItem'
        
    ],
        
    initComponent: function(){
            
    this.editing Ext.create('Ext.grid.plugin.CellEditing');
            
    Ext.apply(this, {
                
    iconCls'icon-grid',
                
    frametrue,
                
    plugins: [this.editing],
                
    dockedItems: [{
                    
    xtype'toolbar',
                    
    items: [{
                        
    iconCls'icon-add',
                        
    text'Add',
                        
    scopethis,
                        
    handlerthis.onAddClick
                    
    }, {
                        
    iconCls'icon-delete',
                        
    text'Delete',
                        
    disabledtrue,
                        
    itemId'delete',
                        
    scopethis,
                        
    handlerthis.onDeleteClick
                    
    }]
                }, {
                    
    weight2,
                    
    xtype'toolbar',
                    
    dock'bottom',
                    
    items: [{
                        
    xtype'tbtext',
                        
    text'<b>@cfg</b>'
                    
    }, '|', {
                        
    text'autoSync',
                        
    enableToggletrue,
                        
    pressedtrue,
                        
    tooltip'When enabled, Store will execute Ajax requests as soon as a Record becomes dirty.',
                        
    scopethis,
                        
    toggleHandler: function(btnpressed){
                            
    this.store.autoSync pressed;
                        }
                    }, {
                        
    text'batch',
                        
    enableToggletrue,
                        
    pressedtrue,
                        
    tooltip'When enabled, Store will batch all records for each type of CRUD verb into a single Ajax request.',
                        
    scopethis,
                        
    toggleHandler: function(btnpressed){
                            
    this.store.getProxy().batchActions pressed;
                        }
                    }, {
                        
    text'writeAllFields',
                        
    enableToggletrue,
                        
    pressedfalse,
                        
    tooltip'When enabled, Writer will write *all* fields to the server -- not just those that changed.',
                        
    scopethis,
                        
    toggleHandler: function(btnpressed){
                            
    this.store.getProxy().getWriter().writeAllFields pressed;
                        }
                    }]
                }, {
                    
    weight1,
                    
    xtype'toolbar',
                    
    dock'bottom',
                    
    ui'footer',
                    
    items: ['->', {
                        
    iconCls'icon-save',
                        
    text'Sync',
                        
    scopethis,
                        
    handlerthis.onSync
                    
    }]
                }],
                
    columns: [{
                    
    text'ID',
                    
    width40,
                    
    sortabletrue,
                    
    resizablefalse,
                    
    draggablefalse,
                    
    hideablefalse,
                    
    menuDisabledtrue,
                    
    dataIndex'id',
                    
    renderer: function(value){
                        return 
    Ext.isNumber(value) ? value '&nbsp;';
                    }
                }, {
                    
    header'Email',
                    
    flex1,
                    
    sortabletrue,
                    
    dataIndex'email',
                    
    field: {
                        
    type'textfield'
                    
    }
                }, {
                    
    header'First',
                    
    width100,
                    
    sortabletrue,
                    
    dataIndex'first',
                    
    field: {
                        
    type'textfield'
                    
    }
                }, {
                    
    header'Last',
                    
    width100,
                    
    sortabletrue,
                    
    dataIndex'last',
                    
    field: {
                        
    type'textfield'
                    
    }
                }]
            });
            
    this.callParent();
            
    this.getSelectionModel().on('selectionchange'this.onSelectChangethis);
        },
        
    onSelectChange: function(selModelselections){
            
    this.down('#delete').setDisabled(selections.length === 0);
        },
        
    onSync: function(){
            
    this.store.sync();
        },
        
    onDeleteClick: function(){
            var 
    selection this.getView().getSelectionModel().getSelection()[0];
            if (
    selection) {
                
    this.store.remove(selection);
            }
        }
    }); 
    here is my store
    PHP Code:
    Ext.define('Admin.store.GridList', {
        
    extend'Ext.data.Store',
        
    requires: [
            
    'Admin.model.GridList'
        
    ],
        
    model'Admin.model.GridList',
        
    alias:'store.gridlist' ,
        
    storeId'gridlist',
        
    constructor: function(cfg) {
            var 
    me this;
            
    cfg cfg || {};
            
    me.callParent([Ext.apply({
                
    autoLoadtrue,
                
    storeId'gridlist',
                
    pageSize25,
                
    autoSynctrue
            
    }, cfg)]);
        }

    }); 
    and here is my model
    PHP Code:
    Ext.define('Admin.model.GridList', {
        
    extend'Admin.model.Base',
        
    fields: [{
            
    name'id',
            
    type'int',
            
    useNulltrue
        
    }, 'email''first''last'],
        
    proxy: {
            
    type'jsonp',            
            
    api: {
                
    read'resources/php/contoh/view.php',
                
    create'resources/php/contoh/create.php',
                
    update'resources/php/contoh/update.php',
                
    destroy'resources/php/contoh/destroy.php'
            
    },
            
    reader: {
                
    type'json',
                
    successProperty'success',
                
    rootProperty'data',
                
    messageProperty'message'
            
    },
            
    writer: {
                
    type'json',
                
    encodetrue,
                
    writeAllFieldsfalse,
                
    rootProperty'data'
            
    },
            
    listeners: {
                
    exception: function(proxyresponseoperation){
                    
    Ext.MessageBox.show({
                        
    title'REMOTE EXCEPTION',
                        
    msgoperation.getError(),
                        
    iconExt.MessageBox.ERROR,
                        
    buttonsExt.Msg.OK
                    
    });
                }
            }
        },
        
    listeners: {
            
    write: function(proxyoperation){
                if (
    operation.action === 'destroy') {
                    
    main.child('#form').setActiveRecord(null);
                }
                
    //Ext.example.msg(operation.action, operation.getResultSet().message);
            
    }
        },
        
    validators: {
            
    email: {
                
    type'length',
                
    min1
            
    },
            
    first: {
                
    type'length',
                
    min1
            
    },
            
    last: {
                
    type'length',
                
    min1
            
    }
        }
    }); 

  2. i have found that i forgot to follow the rule that name of file should same with object definition

  3. #2
    Sencha User
    Join Date
    Apr 2007
    Location
    Indonesia
    Posts
    31
    Answers
    3

    Default

    i have found that i forgot to follow the rule that name of file should same with object definition

Similar Threads

  1. How to apply admin-dashboard template
    By aram256 in forum Ext JS 6.x Q&A
    Replies: 19
    Last Post: 19 Aug 2017, 1:16 AM
  2. Is Admin Dashboard working progress?
    By wemerson.januario in forum Ext JS 6.x Q&A
    Replies: 4
    Last Post: 26 Mar 2017, 9:08 PM
  3. SenchaDash - Admin Dashboard source
    By wemerson.januario in forum Ext JS 6.x Q&A
    Replies: 2
    Last Post: 24 Jun 2016, 4:09 AM
  4. [FIXED] Admin Dashboard - Toolstrip shift
    By nicolas_sahbi in forum Ext JS 6.x Bugs
    Replies: 2
    Last Post: 26 Aug 2015, 8:04 AM
  5. admin-dashboard example on table and mobile run slow?
    By franklt69 in forum Ext JS 6.x Q&A
    Replies: 0
    Last Post: 17 Jul 2015, 8:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •