Gantt + Scheduler custom field to taskstore

Ask our community for help with v1.x versions of our products.
Post Reply
User avatar
lobocroiden
Posts: 74
Joined: Mon Jun 30, 2014 11:13 am

Gantt + Scheduler custom field to taskstore

Post by lobocroiden »

Hi ,

How we can add custom fields to Taskstore?

Thanks

User avatar
mats
Core Developer
Core Developer
Posts: 16236
Joined: Sat Dec 19, 2009 11:41 pm
Location: Sweden
Contact:

Re: Gantt + Scheduler custom field to taskstore

Post by mats »

You add fields to a **Model** then consume your model in your store. Please see the Ext JS docs.

http://docs.sencha.com/extjs/4.2.2/#!/a ... data.Model
Tired of debugging javascript errors in web applications? Try our new error logging service RootCause, or read more on the Sencha blog

@bryntum
Facebook
API documentation

User avatar
lobocroiden
Posts: 74
Joined: Mon Jun 30, 2014 11:13 am

Re: Gantt + Scheduler custom field to taskstore

Post by lobocroiden »

Hi ,

I wanted to add "FormLink" field to TaskStore. And below is my code:

Code: Select all

Ext.define("MyApp.store.TaskStore", {
    extend      : 'Gnt.data.TaskStore',
    rootVisible : false,
    proxy       : 'memory',
	fields : [
		{ name : 'FormLink', type:'string'   }
	],
    loadData: function(data, append) {
        var length = data.length,
            newData = [],
            i;

        for (i = 0; i < length; i++) {
            newData.push(this.createModel(data[i]));
        }

        this.loadRecords(newData, append ? this.addRecordsOptions : undefined);
    },
    populateDataStores : function (response, options) {
		//console.log(response.responseText);
		var data=eval('(' + response.responseText + ')');
		
		if (data.calendars && data.calendars["default"]) {
            this.calendar.loadData(data.calendars["default"]);
        }

        if (data.dependencies) {
            this.dependencyStore.loadData([]);
        }

        if (data.assignments) {
            this.assignmentStore.loadData(data.assignments);
        }
		 
        if (data.resources) {	
			this.resourceStore.loadData(data.resources);
        }
        // Now all is in place, continue with tasks
        this.setRootNode(data);
    }								
});
But this is not reflecting. Please help me.

Thanks.

User avatar
Maxim Gorkovsky
Core Developer
Core Developer
Posts: 3092
Joined: Wed Jan 08, 2014 11:46 am

Re: Gantt + Scheduler custom field to taskstore

Post by Maxim Gorkovsky »

You should do smth like this:

Code: Select all

Ext.define('myModel', {
    extend : 'Gnt.model.Task',
    customizableFields : [{ name : 'MyField' }]
});

Ext.define('MyApp.store.TaskStore', {
    extend : 'Gnt.data.TaskStore',
    model : 'myModel'
});

User avatar
lobocroiden
Posts: 74
Joined: Mon Jun 30, 2014 11:13 am

Re: Gantt + Scheduler custom field to taskstore

Post by lobocroiden »

Thanks. It worked :)

Post Reply