Show cool things you have done with our products


Post by intelizign »

Hi,
How to load JSON data from browser's sessionStorage instead of url:'services/load',
I am using gantt-pro-4.1.1.1, webapp\js\advanced\crud\CrudManager.js
I tried this thread of Mats https://stackoverflow.com/questions/3021 ... 7#30289447
but failed with error "ext-all.js:19 Uncaught TypeError: Cannot read property 'indexOf' of null"

I want to use it something like:
Ext.define('Gnt.examples.advanced.crud.CrudManager', {
    extend          : 'Gnt.data.CrudManager',
    alias           : 'crudmanager.advanced-crudmanager',
    autoLoad        : true,
    transport       : {
        load : {
                     expanded : true,
                     children :  sessionStorage.getItem("ganttJSONData") 
                  },
        sync : {
            url         : 'js/saved.json'
        }
    }
});
Can anyone suggest some work around to get it working? Bit urgent.

Post by mats »

Well, what have you tried so far? You can see in all our sample the data format we expect. What does this give you?
sessionStorage.getItem("ganttJSONData") 

Post by intelizign »

what have you tried so far?
I have tried various options such as
root : {
		expanded : true,
		children : sessionStorage.getItem("ganttJSONData")
	}
load: {
		expanded : true,
		children : sessionStorage.getItem("ganttJSONData")
	}
load: {
		expanded : true,
		children : [{"success": true,"assignments": {"rows": [{"Id": 1," ........ "ManuallyScheduled": false}]}]}}]
	}
load: {
		url         : [{"success": true,"assignments": {"rows": [{"Id": 1," ........ "ManuallyScheduled": false}]}]}}],
    	        paramName   : 'q',
    	        method      : 'GET',
}
but no success. All goes just as hit & trial ;)

You can see in all our sample the data format we expect.
I search for it but can't find any proper list, please help me to locate it.
I just have to stick with HTML & JS code only, NO JAVA, NO PHP. Because I'm focusing on GWT which doesn't provide full support for others.

What does this give you?
This provides me a JSON data in string format (similar as provided in data.js in examples)...
[{"success": true,"assignments": {"rows": [{"Id": 1," ........ "ManuallyScheduled": false}]}]}}]

Post by Maxim Gorkovsky »

Hello.
This guide explains crud manager logic. It uses special Sch.crud.transport.Ajax mixin to make requests which cannot be configured to return what you want.

I see following options for you:
1) define new transport class, it should implement methods described in documentation for ajax transport, define new crud manager class and mix this transport in it. E.g. your sendRequest method can look like this:
sendRequest : function (config) {
  ...
  config.success.call(config.scope || this, your_data_here_as_a_string);
  ...
}
2) Use sim manager, but it will handle all ajax requests and you'll need to do some extra work to make certian requests to pass through it. Everything is descrived in that doc.

3) Avoid using crud manager. If you already have all data loaded on client you maybe don't need crud manager at all. In that case just load data as described in that stackoverflow post you mentioned. I'd go with this option.

Do you need crud manager?

Post by intelizign »

Hi Maxim,
Thanks for your reply.

Yah, I want to avoid crud manager, but without loosing any functionality, specially ms project import, export, histogram, scheduler and taskboard. i'm ok with its js part but can't go with JAVA. Is it possible?

I was looking for your option #3 only and tried to implement as described in that stackoverflow post. But probably due to version difference i couldn't find place to implement 'root' option.
Could you please drive me to the place where i need to change?
As i have mentioned I am using gantt-pro-4.1.1.1\examples\advanced\app\crud\CrudManager.js

Post by Maxim Gorkovsky »

Crud manager is only meant to wrap multiple store requests into single one, it doesn't affect any other features.

Option 3 implies you do not have a crud manager. You should remove all references to it (I advise you to make a backup of project) and move taskStore, dependencyStore, etc. to panel config. After that you can configure task store as any other extjs store. Keep in mind, that data structure you see in our example is special for crud manager. For task store you can use subset of that json - tasks.rows
var taskStore = new Gnt.data.TaskStore({
  root : {
    Id : 1,
    Name : 'root',
    children : data.tasks.rows // assuming you loaded data.json into object 'data'
  }
});

Post Reply