|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Dijit Calender calling getClassForDate manuallyHi all,
i'm new to the dojo toolkit and I begin to like it since it offers many useful features. I'm currently trying to get the dijit calendar widget to mark certain dates (which I retrieve from a database via xhrGet / PHP). The widget appeared to be nice at first, but causes me some serious problems since it seems not to be designed for stuff like that. My most important question is this: Is there a way to get the widget to re-render the dates by calling getClassForDate? Since I have an asynchronous call to the database, the widget is displayed (and such "getClassForDates" is called) before the answer to the request arrives. So I would like to trigger the (re-)rendering of the dates manually as soon as the relevant data is present. How is this possible? Another problem that I was facing is that I would like to get an event when the user switches the date by pressing the "next" or "previous" arrow buttons on the top of the widget to switch to the next or previous month, meaning that I would I like to now which month and year is currently displayed. Is there an event for that? I could not find anything in the api (or in the source - at least at first glance). I solved this by also using the getClassForDate function, but it is not a very nice solution. So is there an easier way? Thanks in advance, Michael H. _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: Dijit Calender calling getClassForDate manuallyWell to rerender the calendar is simple, this._populateGrid() to get current displayed month... this.displayMonth
(all gleaned from looking at _adjustDisplay) note: _Calendar isnt a public class, so its API is subject to change its primarily used to inherit from for larger calendar based things -Karl Tiedt _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
|
|
|
Re: Dijit Calender calling getClassForDate manuallyHi, thanks to both of you. This information is very helpful, I will
experiment with the widget a bit. Greetings, Michael Adam Peller schrieb: > On Fri, Nov 6, 2009 at 9:05 AM, Michael Helwig wrote: > > i'm new to the dojo toolkit and I begin to like it since it offers > many > useful features. I'm currently trying to get the dijit calendar widget > to mark certain dates (which I retrieve from a database via xhrGet / > PHP). The widget appeared to be nice at first, but causes me some > serious problems since it seems not to be designed for stuff like > that. > > > Yup... does not seem to account for asynch at all. The widget was > deliberately kept light and simple, but perhaps there is a way to be > more accommodating for asynch without adding much code? > > > My most important question is this: > Is there a way to get the widget to re-render the dates by calling > getClassForDate? > > > getClassForDate is called by the Calendar code and, as you point out, > does not make allowances for asynch callbacks. > > > Since I have an asynchronous call to the database, the widget is > displayed (and such "getClassForDates" is called) before the answer to > the request arrives. So I would like to trigger the (re-)rendering of > the dates manually as soon as the relevant data is present. How is > this > possible? > > > As Karl mentioned, you'd probably need to change the rendering logic. > Simply calling _populateGrid at the right time to repopulate might > also be an option, but it would likely result in some multiple > rendering and jumping around, so you might find yourself subclassing > and inserting some logic. Karl's right to point out that > _populateGrid is a private method -- no guarantees on API stability. > Calendar itself, however, is being promoted from _Calendar in the 1.4 > release. > > Another problem that I was facing is that I would like to get an event > when the user switches the date by pressing the "next" or "previous" > arrow buttons on the top of the widget to switch to the next or > previous > month, meaning that I would I like to now which month and year is > currently displayed. Is there an event for that? I could not find > anything in the api (or in the source - at least at first glance). > I solved this by also using the getClassForDate function, but it > is not > a very nice solution. So is there an easier way? > > > There's only an event when the selection actually changes, not when > the user scrolls to a different month/year, and unfortunately there > are many codepaths to get there. You could try doing a dojo.connect > to _populateGrid. I think that's the only thing that the codepaths > have in common, and it would be called less frequently than > getClassForDate. > > ------------------------------------------------------------------------ > > _______________________________________________ > FAQ: http://dojotoolkit.org/support/faq > Book: http://docs.dojocampus.org > Dojo-interest@... > http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest > _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
| Free embeddable forum powered by Nabble | Forum Help |