onLoad event for Store
11 posts
• Page 1 of 2 • 1, 2
onLoad event for Store
Hey!
I have a problem, and I see one or two options to solve it, but as usual I want to ask you guys first, because there is normally a easier solution
The situation:
I have a gantt chart 1.x and a few columns in it. ONE of the columns has a renderer which searches an additional DirectStore 'feedStore', and if a record exists it returns <img>PictureA</img> otherwise <img>PictureB</img>.
The problem:
when the gantt chart column is rendered, obviously there feedStore hasn't been loaded. I assume that by the following tests: When adding console.log(feedStore.getTotalCount), I get a long list of ZEROs. The other thing is, that when I debug with breakpoints, I get the desired result (obviously the store has finished loading the data).
So what to do now?
a.) Add 'load' event to the feedStore and make DOM manupilation for all cells with the pictures
b.) Somehow implement an 'initiallyLoaded' property as in the AdjacencyStore (btw: there is a typo, it's called 'intiallyLoaded'
), and do something similar as this in the column renderer: while(!feedStore.initiallyLoaded) { WAIT }
Any other suggestions? I don't like either of the ways, maybe you know what I should do
Thanks and best regards,
Nisse
I have a problem, and I see one or two options to solve it, but as usual I want to ask you guys first, because there is normally a easier solution
The situation:
I have a gantt chart 1.x and a few columns in it. ONE of the columns has a renderer which searches an additional DirectStore 'feedStore', and if a record exists it returns <img>PictureA</img> otherwise <img>PictureB</img>.
The problem:
when the gantt chart column is rendered, obviously there feedStore hasn't been loaded. I assume that by the following tests: When adding console.log(feedStore.getTotalCount), I get a long list of ZEROs. The other thing is, that when I debug with breakpoints, I get the desired result (obviously the store has finished loading the data).
So what to do now?
a.) Add 'load' event to the feedStore and make DOM manupilation for all cells with the pictures
b.) Somehow implement an 'initiallyLoaded' property as in the AdjacencyStore (btw: there is a typo, it's called 'intiallyLoaded'
Any other suggestions? I don't like either of the ways, maybe you know what I should do
Thanks and best regards,
Nisse
-

NisseKnudsenSystecs - Premium Member

- Posts: 232
- Joined: Mon Mar 21, 2011 11:09 am
Re: onLoad event for Store
Load taskstore in the load listener of the extra store? Or send back all data with the same dataset, faster and more elegant I guess. Also, refreshing the view on the extra store load would be fine too.
We're hiring! We have an open position for an experienced Sencha developer (Ext JS and/or Sencha Touch). Contact us at jobs@bryntum.com
Follow us on Twitter: @bryntum or Facebook
Need professional services or training? Read more here.
API documentation
Follow us on Twitter: @bryntum or Facebook
Need professional services or training? Read more here.
API documentation
-

mats - Core Developer

- Posts: 7081
- Joined: Sat Dec 19, 2009 11:41 pm
- Location: Sweden
Re: onLoad event for Store
Hey Mats!
Thanks for your answer! Acutally I first had it in the taskStore, but this wasn't performant at all. I just want to change a small flag, the is kind of associated with a task, but not in the same database table. So I had to distinguish if only this flag has changed or anything else on the task record. This would have taken too much time, so I create a second store!
But your load listener did the trick!
Now I have a small problem, which you might help me with: After succesfully setting/unsetting the flag via the second store, I would like to 'rerender' one cell in the gantt, actually it is one row in one of the columns. Is there a way for that?
Thanks for your answer! Acutally I first had it in the taskStore, but this wasn't performant at all. I just want to change a small flag, the is kind of associated with a task, but not in the same database table. So I had to distinguish if only this flag has changed or anything else on the task record. This would have taken too much time, so I create a second store!
But your load listener did the trick!
Now I have a small problem, which you might help me with: After succesfully setting/unsetting the flag via the second store, I would like to 'rerender' one cell in the gantt, actually it is one row in one of the columns. Is there a way for that?
-

NisseKnudsenSystecs - Premium Member

- Posts: 232
- Joined: Mon Mar 21, 2011 11:09 am
Re: onLoad event for Store
Nope, rerendering cells is not supported. You can add support for it, but you'll need to do plenty of digging inside of Ext JS GridView classes. Not recommended for a healthy lifestyle 
We're hiring! We have an open position for an experienced Sencha developer (Ext JS and/or Sencha Touch). Contact us at jobs@bryntum.com
Follow us on Twitter: @bryntum or Facebook
Need professional services or training? Read more here.
API documentation
Follow us on Twitter: @bryntum or Facebook
Need professional services or training? Read more here.
API documentation
-

mats - Core Developer

- Posts: 7081
- Joined: Sat Dec 19, 2009 11:41 pm
- Location: Sweden
Re: onLoad event for Store
Haha
Thanks for that honest answer
;)
Actually I found another solution: On success of 'save' operation I just change the CSS class of that very cell, in case of failure it stays at it is (the only thing that changes is an icon)
Actually I found another solution: On success of 'save' operation I just change the CSS class of that very cell, in case of failure it stays at it is (the only thing that changes is an icon)
-

NisseKnudsenSystecs - Premium Member

- Posts: 232
- Joined: Mon Mar 21, 2011 11:09 am
Re: onLoad event for Store
Hey, one additional question:
Is it possible to block any click activity on a cell? Maybe by disabling onclick events or showing a layer on top of it?
Thanks!!
Is it possible to block any click activity on a cell? Maybe by disabling onclick events or showing a layer on top of it?
Thanks!!
-

NisseKnudsenSystecs - Premium Member

- Posts: 232
- Joined: Mon Mar 21, 2011 11:09 am
Re: onLoad event for Store
Why? Use case?
We're hiring! We have an open position for an experienced Sencha developer (Ext JS and/or Sencha Touch). Contact us at jobs@bryntum.com
Follow us on Twitter: @bryntum or Facebook
Need professional services or training? Read more here.
API documentation
Follow us on Twitter: @bryntum or Facebook
Need professional services or training? Read more here.
API documentation
-

mats - Core Developer

- Posts: 7081
- Joined: Sat Dec 19, 2009 11:41 pm
- Location: Sweden
Re: onLoad event for Store
The column contains a picture which has a onclick event. This event adds a record to the store OR removes a record from the store, depending on if it exists or not. The changes are sent to the server via DirectProxy.
This thing fails if someone clicks more than once inbetween a short time period on the icon, e.g. 4 times.
Maybe I shoudl just remove the event handler?
This thing fails if someone clicks more than once inbetween a short time period on the icon, e.g. 4 times.
Maybe I shoudl just remove the event handler?
-

NisseKnudsenSystecs - Premium Member

- Posts: 232
- Joined: Mon Mar 21, 2011 11:09 am
Re: onLoad event for Store
Ok, never mind, I solved it with the event handler: when onClick is executed, the element is being set to elem.onClick = null; so you can try to double click as much as you want 
-

NisseKnudsenSystecs - Premium Member

- Posts: 232
- Joined: Mon Mar 21, 2011 11:09 am
Re: onLoad event for Store
One click listener per cell sounds like a bad idea. Read up on event delegation here
http://docs.sencha.com/core/manual/cont ... t-handling
We're hiring! We have an open position for an experienced Sencha developer (Ext JS and/or Sencha Touch). Contact us at jobs@bryntum.com
Follow us on Twitter: @bryntum or Facebook
Need professional services or training? Read more here.
API documentation
Follow us on Twitter: @bryntum or Facebook
Need professional services or training? Read more here.
API documentation
-

mats - Core Developer

- Posts: 7081
- Joined: Sat Dec 19, 2009 11:41 pm
- Location: Sweden
11 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 1 guest