1. #1
    Sencha User
    Join Date
    Apr 2011
    Location
    Surat, Gujarat, India
    Posts
    126
    Vote Rating
    0
    rushi2440 is on a distinguished road

      0  

    Default Unanswered: me.events is undefined me.events[ename] = me.events[ename] |

    Unanswered: me.events is undefined me.events[ename] = me.events[ename] |


    Hi.. sencha forum member I am having one problem with using window containing the panel.

    I am having my resource panel code as below
    Code:
    var combo = new Ext.form.ComboBox({
        store: new Ext.data.ArrayStore({
            id: 0,
            fields: [
                'Id',
                'displayText'
            ],
            data: [[0, 'Low'], [1, 'Normal'], [2, 'High']]
        }),
        triggerAction: 'all',
        mode: 'local',
        valueField: 'Id',
        displayField: 'displayText'
    });
    
    
    TaskPriority = {
            Low : 0,
            Normal : 1,
            High : 2
    };
    
    
    Ext.define('CustomAssignmentCellEditor', {
        extend : "Gnt.widget.AssignmentCellEditor",
        
        show: function(){
            console.log('SHOW ', this.resourceStore.getCount());
    
    
            this.callParent(arguments);
        }
    });
    
    
    Ext.define('rms.view.projectmgt.taskResource',{
        extend: 'Gnt.panel.Gantt',
        alias: 'widget.taskresource',
        
        requires: [
            'Gnt.plugin.TaskContextMenu',       
            'Gnt.column.StartDate',
            'Gnt.column.EndDate',
            'Gnt.column.Duration',
            'Gnt.column.PercentDone',
            'Sch.plugin.TreeCellEditing',
            'Gnt.column.ResourceAssignment',
            'Gnt.widget.AssignmentCellEditor',
            'Gnt.model.Assignment',
            'Sch.plugin.Pan'
        ],
        
        height : 400,
        width: 1000,
        startDate : new Date(2010,0,11), 
        endDate : Sch.util.Date.add(new Date(2010,0,11), Sch.util.Date.WEEK, 20), 
        
        multiSelect : true,
        cascadeChanges: true,
        viewPreset: 'weekAndDayLetter',
        recalculateParents: false,
        showTodayLine               : true,
        showBaseline                : true,
        
        highlightWeekends : true,
        showTodayLine : true,
        loadMask : true,
        enableDependencyDragDrop : false,
        snapToIncrement : true,
        multiSelect: true,
        cascadeChanges: true,
        
            // Object with editor and dataIndex defined
            leftLabelField : {
            dataIndex : 'Name',
            editor : { xtype : 'textfield' }
        },
        
        // ... or an object with editor and renderer defined
        rightLabelField : {
            dataIndex : 'Id',
            renderer : function(value, record) {
            return 'Id: #' + value;
        }
        },
        
        
        initComponent: function() {
            var me = this;
            
            me.on({
                scope: me,
                beforeload: function(store,records,options) {
                    console.log('BEFORE LOAD YAAR panel'+records.params);
                    console.log('BEFORE LOAD YAAR panel PROJECTID '+records.params['projectid']);
                      if(records.params['projectid'] != null)
                      {
                          return true;
                      }
                      else
                      {
                          return false;
                      }
                }            
            });
            
            var assignmentStore = Ext.create('rms.store.assignment');
            var resourceStore = assignmentStore.resourceStore;
            var taskStore = Ext.data.StoreManager.lookup('task'); 
            
             var assignmentEditor = Ext.create('CustomAssignmentCellEditor', {
                    assignmentStore : assignmentStore,
                    resourceStore : resourceStore
                });
            
            Ext.apply(me, {
                    resourceStore : resourceStore,
                    assignmentStore : assignmentStore,
                    taskStore : taskStore,
                    stripeRows : true,
                    
                    plugins: [
                                Ext.create('Sch.plugin.TreeCellEditing', { 
                                     clicksToEdit: 1
                                 })
                              ],
                              
                eventRenderer : function(task) {
                    if (assignmentStore.findExact('TaskId', task.data.Id) >= 0) {
                        // This task has resources assigned, show a little icon
                        return {
                            ctcls : 'resources-assigned'
                        };
                    }
                },
                
             // Setup your static columns
                columns : [
                    {
                        xtype : 'treecolumn',
                        header : 'Tasks', 
                        dataIndex : 'Name', 
                        width:250
                    },
                    new Gnt.column.StartDate(),
                    new Gnt.column.Duration(),
                     new Gnt.column.PercentDone(),
                     {
                         header: 'Priority',
                         width: 50,
                         dataIndex: 'Priority',
                         renderer: function (v, m, r) {
                             switch (v) {
                                 case TaskPriority.Low:
                                     return 'Low';
    
    
                                 case TaskPriority.Normal:
                                     return 'Normal';
    
    
                                 case TaskPriority.High:
                                     return 'High';
                             }
                         },
                        field: combo
                     },
                     {
                          xtype       : 'booleancolumn',
                          width       : 50,
                          
                          header      : 'Manual',
                          
                          dataIndex   : 'ManuallyScheduled',
                          
                          field       : { 
                              xtype   : 'combo',
                              store   : [ 'true', 'false' ]
                          }
                     },
                    {
                        header : 'Assigned Resources', 
                        width:150, 
                        editor : assignmentEditor,
                        xtype : 'resourceassigmentcolumn'
                    }
                ],
                
                tooltipTpl: new Ext.XTemplate(
                        '<h4 class="tipHeader">{Name}</h4>',
                        '<table class="taskTip">',
                        '<tr><td>Start:</td> <td align="right">{[Ext.Date.format(values.StartDate, "y-m-d")]}</td></tr>',
                        '<tr><td>End:</td> <td align="right">{[Ext.Date.format(Ext.Date.add(values.EndDate, Ext.Date.MILLI, -1), "y-m-d")]}</td></tr>',
                        '<tr><td>Progress:</td><td align="right">{PercentDone}%</td></tr>',
                        '</table>'
                ).compile(),
                
                tbar : [
                        {
                            text : 'Indent',
                            iconCls : 'indent',
                            handler : function() {
                                var sm = g.lockedGrid.getSelectionModel();
                                sm.selected.each(function(t) {
                                    t.indent();
                                });
                            }
                        },
                        {
                            text : 'Outdent',
                            iconCls : 'outdent',
                            handler : function() {
                                var sm = g.lockedGrid.getSelectionModel();
                                sm.selected.each(function(t) {
                                    t.outdent();
                                });
                            }
                        }
                    ]
            });
            
            me.callParent(arguments);
            
        }
    });
    my resource panel has two main store
    Code:
    var assignmentStore = Ext.create('rms.store.assignment');
    var resourceStore = assignmentStore.resourceStore;
    var taskStore = Ext.data.StoreManager.lookup('task');
    my assignmentStore code is given below
    Code:
    Ext.define('rms.store.assignment', {
        extend: 'Ext.data.Store',
        model: 'rms.model.assignmentModel',
        storeId: 'assignmentStore',
        autoLoad: true,
        constructor: function() {
            var me = this;
            var resourceStore=  Ext.create('rms.store.resource');
        },
        proxy: {
            type : 'ajax',
            method: 'GET',
            reader: new Ext.data.JsonReader({
                root: 'assignmentdata',
                type : 'json'
            }),
            writer : new Ext.data.JsonWriter({
                root: 'assignmentdata',
                type : 'json',
                totalPropery: 'total',
                successProperty : 'success',
                idProperty : 'id',
                encode : true,
                writeAllFields : true
            }),
            api: {
                read : 'assignment/GetAssignment.action',
                create: 'assignment/CreateAssignment.action',
                update: 'assignment/UpdateAssignment.action',
                destroy: 'assignment/DeleteAssignment.action'
            }
        },    
        listeners : {
            load : function() {
                this.resourceStore.loadData(this.proxy.reader.jsonData.resourcedata);
            }
        }
    });
    and my resourceStore code is
    Code:
    Ext.define('rms.store.resource', {
        extend: 'Ext.data.Store',
        model: 'rms.model.resourceModel',
        storeId: 'resourceStore',
        autoLoad: true,
        
        proxy: {
            type : 'ajax',
            method: 'GET',
            reader: new Ext.data.JsonReader({
                root: 'resourcedata',
                type : 'json'
            }),
            writer : new Ext.data.JsonWriter({
                root: 'resourcedata',
                type : 'json',
                totalPropery: 'total',
                successProperty : 'success',
                idProperty : 'id',
                encode : true,
                writeAllFields : true
            }),
            api: {
                read : 'resource/GetResource.action',
                create: 'resource/CreateResource.action',
                update: 'resource/UpdateResource.action',
                destroy: 'resource/DeleteResource.action'
            }
        }
    });
    don't know when I load the window containing the resourcepanel I get below error
    me.events is undefined
    [Break On This Error]

    me.events[ename] = me.events[ename] || true;

    my window containing the resource panel is
    Code:
    Ext.define('rms.view.projectmgt.taskAdd' ,{
        extend: 'Ext.Window',
        alias : 'widget.taskaddwindow',
         id: 'taskaddwindow',
        title: 'Task Management Window',
        width: '85%',
        height: '85%',
        closeAction: 'destroy',
        closable : true,
        modal: true,
        constrain: true, 
        maximizable: true,  
        stateful: false,
        projectid: null, // this will be set before showing window
        layout: 'border',
        initComponent: function() {    
            this.layoutConfig = {
                align: 'stretch'
            };
            this.items = [
                {
                        region: 'center',
                        xtype: 'taskresource',
                        //html: 'taskpanel',
                        width: '85%',
                        height: '85%'
                }
            ];
            
           this.on({
                scope: this,
                beforeshow: this.onBeforeShow
            });
            this.callParent(arguments);
        },
        onBeforeShow: function() {
            var projectid = this.projectid;
            if(projectid != null) {
                var store = Ext.data.StoreManager.lookup('task');
                console.log('BEFOR SHOW ::'+projectid);
    //take the projectid as 1
                store.read({
                    params: {'projectid': projectid},
                    callback: function(options, success, response) {  
                        console.log('RESPONSE FROM SERVER :'+response.responseText);
                    } //callback
                });
                var assignmentStore = Ext.data.StoreManager.lookup('assignment');
                assignmentStore.load();
            }
        }
    });
    Please suggest me what's wrong I had done in my code. And help me to solve it soon as possible.


    Yogendra Singh
    Sr. Programmer
    Kintudesigns.com

  2. #2
    Sencha - Community Support Team mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    2,639
    Answers
    33
    Vote Rating
    103
    mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all

      0  

    Default


    You must do "this.callParent(arguments)" in your subclassed store constructor.

  3. #3
    Sencha User
    Join Date
    Apr 2011
    Location
    Surat, Gujarat, India
    Posts
    126
    Vote Rating
    0
    rushi2440 is on a distinguished road

      0  

    Default


    @mankz

    thanks so much for your reply. I did the changes as per you said now my assignmentStore is like below code
    Code:
    Ext.define('rms.store.assignment', {
        extend: 'Ext.data.Store',
        model: 'rms.model.assignmentModel',
        storeId: 'assignmentStore',
        autoLoad: true,
        constructor: function() {
            var me = this;
            me.callParent(arguments);
            this.resourceStore =  Ext.create('rms.store.resource');
        },
        resourceStore: this.resourceStore,
        proxy: {
            type : 'ajax',
            method: 'GET',
            reader: new Ext.data.JsonReader({
                root: 'assignmentdata',
                type : 'json'
            }),
            writer : new Ext.data.JsonWriter({
                root: 'assignmentdata',
                type : 'json',
                totalPropery: 'total',
                successProperty : 'success',
                idProperty : 'id',
                encode : true,
                writeAllFields : true
            }),
            api: {
                read : 'assignment/GetAssignment.action',
                create: 'assignment/CreateAssignment.action',
                update: 'assignment/UpdateAssignment.action',
                destroy: 'assignment/DeleteAssignment.action'
            }
        }
    });
    and my resourceStore code is like below
    Code:
    Ext.define('rms.store.resource', {
        extend: 'Ext.data.Store',
        model: 'rms.model.resourceModel',
        storeId: 'resourceStore',
        autoLoad: true,
        proxy: {
            type : 'ajax',
            method: 'GET',
            reader: new Ext.data.JsonReader({
                root: 'resourcedata',
                type : 'json'
            }),
            writer : new Ext.data.JsonWriter({
                root: 'resourcedata',
                type : 'json',
                totalPropery: 'total',
                successProperty : 'success',
                idProperty : 'id',
                encode : true,
                writeAllFields : true
            }),
            api: {
                read : 'resource/GetResource.action',
                create: 'resource/CreateResource.action',
                update: 'resource/UpdateResource.action',
                destroy: 'resource/DeleteResource.action'
            }
        }
    });
    my store loads correctly and when I select the Assigned Resource column also shows me the resource correctly like below image snap
    taskpanel.jpg

    In my resourcePanel I am having store defined as below
    Code:
    var assignmentStore = Ext.data.StoreManager.lookup('assignment');
    var resourceStore = Ext.data.StoreManager.lookup('resource');
    var taskStore = Ext.data.StoreManager.lookup('task');
    var dependencyStore = Ext.data.StoreManager.lookup('dependency');
    
    
    var assignmentEditor = Ext.create('CustomAssignmentCellEditor', {
    assignmentStore : assignmentStore,
    resourceStore : resourceStore
    });
    even though my resource also get loads successfully as above, when I select the resource and then press the saveClose button . The selected resource is not viewed in the column also I am not able to send the resource to server to persist it.


    please suggest me some solution why the column didn't show me the selected resource.


    Yogendra Singh
    Sr. Programmer
    Kintudesigns.com
    Attached Images

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar