Premium support for our pure JavaScript UI components


Post by edison.shi »

Hi,

When I using extjsmodern demo and then I want to add multi assign into this demo, but I got some problems.

I add assignmentStore in main.js in extjsmodern
 assignmentStore : {

            },
the console with error:
Uncaught TypeError: e.on is not a function

if I add assignmentStore like :
assignmentStore : null,
it will be fine, but when I add data into stores in MainController.js like
schedulerPanel.getEventStore().add()
schedulerPanel.getResourceStore().add()
schedulerPanel.getAssignmentStore().add()
the eventStore and resourceStore can add like this, but assignmentStore cann't
I debugger and do
schedulerPanel.getAssignmentStore()
in console
the result is 'null'

So how can I use multi assign in extjsmodern demo.

Many thanks

Post by sergey.maltsev »

Hi, edison.shi!

You could try to initialize assignmentStore with this
assignmentStore : new bryntum.scheduler.AssignmentStore(),
I've created a ticket to add support for {} config
https://app.assembla.com/spaces/bryntum/tickets/9415-assignment-store-doesn--39-t-support-%7B%7D-config/details

Post by edison.shi »

Hi sergey.maltsev,

I've tried
assignmentStore : new bryntum.scheduler.AssignmentStore(),
unlucky the console comes with error
Uncaught ReferenceError: bryntum is not defined
I also tried some coding in MainController.js init function like:
var ass = new bryntum.scheduler.AssignmentStore();
	ass.add(data)
The code can run and without any error.
But the assignmentStore doesn't work,

I debugger after
ass.add(data);
debugger;
when I
console.log(schedulerPanel.getAssignmentStore())
in console,
the output is
null

Is there any other way I can create assignmentStore correctly?
By the way how long you can kindly fix the bug :D

Post by arcady »

I've just checked the extjsmodern demo and everything works fine. First I added a store instance (in Main.js file):
...

            // adding assignment store instance
            assignmentStore : new bryntum.scheduler.AssignmentStore(),

            resourceStore : {
                readUrl  : 'data/resources.json',
                autoLoad : true
            },
Now to reach the Bryntum Scheduler API we made a special proxy class Bryntum.SchedulerPanel (you can find it in Bryntum folder of the extjsmodern demo). The class build getters and setters to map certain Scheduler properties.
So to reach the assignment store you should use getAssignmentStore getter:
// get SchedulerPanel instance
var scheduler = Ext.first('schedulerpanel');
// get assignment store
scheduler.getAssignmentStore();
Now let's ensure that it works:
// add "Foo" event
scheduler.getEventStore().add({ id : 1, startDate : p.getStartDate(), endDate : new Date(p.getStartDate().getTime()+3600000), name : "Foo" });
// assign it to the first event
scheduler.getAssignmentStore().add({ resourceId : "r1", eventId : 1 });
After the above steps I saw a new "Foo" event in the scheduler assigned to "Mike" resource.

Post by edison.shi »

Hi,

I tried
assignmentStore : new bryntum.scheduler.AssignmentStore(),
in Main.js

but the console still have error
Uncaught ReferenceError: bryntum is not defined
I don't know why the error comes out.
I used listener in eventStore, when the data change, it will upload to backend, and I use
bryntum.scheduler.Mask.mask()
this is fine.
So that error is very stranger.

I also tried other way in MainController.js
var me = this,
schedulerPanel = me.lookupReference('schedulerPanel');
schedulerPanel.setAssignmentStore(new bryntum.scheduler.AssignmentStore())
schedulerPanel.getAssignmentStore().add(data)
This can help add assignmentStore.

Post by arcady »

Do you use trial version or full distribution?

Post by edison.shi »

Full distribution download in customer zone. Scheduler2.2.0, scheduler.umd.min.js in build folder

Post by arcady »

I tested on Scheduler 2.2.5 ..yet I doubt that's the reason.

Can you please provide a runnable test case showing the exception so we could investigate what happens?

Post Reply