Jump to content

TouchCalendar sencha-touch CalendarPanel


pedrisco

Recommended Posts

I needed a "CalendarPanel" in mobile, so i took Ext.ux.TouchCalendar (https://github.com/SwarmOnline/Ext.ux.TouchCalendar) and merged in my sencha-touch project.

 

I can't upload this sample so i'm gonna leave this here, maybe can help to someone.

 

https://mega.nz/#!P0sgXbIQ!jsTHKaMMb7AzNCImIcQU1MmmQurbXN1ZEb0L8tO4td0

 

Tips:

calendarPanel.uniEvents.afterCreate

dpDate.extEvents.change

dpDate.uniEvents.beforeInit

dpDate.uniEvents.afterCreate

procedure TfrmBitacora.calendarPanelAjaxEvent

 

Link to comment
Share on other sites

I needed a "CalendarPanel" in mobile, so i took Ext.ux.TouchCalendar (https://github.com/SwarmOnline/Ext.ux.TouchCalendar) and merged in my sencha-touch project.

 

I can't upload this sample so i'm gonna leave this here, maybe can help to someone.

 

https://mega.nz/#!P0sgXbIQ!jsTHKaMMb7AzNCImIcQU1MmmQurbXN1ZEb0L8tO4td0

 

Tips:

calendarPanel.uniEvents.afterCreate

dpDate.extEvents.change

dpDate.uniEvents.beforeInit

dpDate.uniEvents.afterCreate

procedure TfrmBitacora.calendarPanelAjaxEvent

 

thank you for this,

errors with latest unigui v1.10

but works with older version

Link to comment
Share on other sites

Sorry, I forgot to mention that, but as far as i know sencha-touch is not included in 1.10., and till now i haven't found a "plug&play" theme, that's why i'm still using sencha-touch. Maybe is just a matter of include it.

Moreover, i thought that in 1.10 there is no difference between mobile and desktop (!?).

Link to comment
Share on other sites

I would say "selectionchange".

calendar.on('selectionchange', function(calendar, newDate, oldDate){
                        console.log('selectionchange');
                        console.log(calendar);
                    });

 

I've not tried all of them but you can see more events here https://github.com/SwarmOnline/Ext.ux.TouchCalendar/blob/master/examples/Ext.ux.TouchCalendarEvents.html .

Link to comment
Share on other sites

to change the view ...

frmBitacora.touchCalendar.setViewMode('month'); //month, week , day

 

to populate the store...

frmBitacora.touchCalendar.view.eventStore.setData( [
{event:"text1", start:new Date(), end: new Date()},
{event:"text2", start:new Date(), end: new Date()},

...
] );

Link to comment
Share on other sites

Thanks again.

 

OK, I now see how you do Month / Week / Day view.

 

Using your example I have added a second event.

 

1) Events fail to show in Week and Day mode ?

 

2) Going from Month to Week to Day (scroll to 11pm), now goto Month View - it fails to show Month etc.. If I go back to Day and scroll back to 7am etc. it now works again ?

 

My goal is to Populate the events Store from a DataSet, any help here would be greatly appreciated.

 

 

        jsonString := '';
        jsonString := jsonString+'{'
                    + 'event:"' + 'any text here'+'"'
                    + ',start:"'+ formatDateTime( 'yyyy-mm-dd', now )+'"'
                    + ',end:"'  + formatDateTime( 'yyyy-mm-dd', now )+'"'
                    + '},'
 
                    + '{event:"' + 'any text here'+'"'
                    + ',start:"'+ formatDateTime( 'yyyy-mm-dd', now + 1)+'"'
                    + ',end:"'  + formatDateTime( 'yyyy-mm-dd', now + 1)+'"'
 
                    + '},';
        uniSession.AddJS(
            'frmBitacora.touchCalendar.view.eventStore.setData(['
            +copy(jsonString,1,length(jsonString)-1)
            +'])'
        );
 
Link to comment
Share on other sites

I've found some issues too, it's buggy.

You can find the same issue in the sample https://www.swarmonline.com/Ext.ux.TouchCalendar/examples/Ext.ux.TouchCalendar.html, when you scroll down the day view, the other views scroll down too.

 

I know it's uggly but after "setView" do this...

 

setTimeout(function(){
    frmBitacora.touchCalendar.view.innerElement.setStyle({transform:""});
  },50); //increment if you need

 

 

to populate i'm doing this...

procedure TfrmBitacora.calendarPanelAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings);
      var date1,date2:String;
          jsonString:String;
begin
    if eventName='periodchange' then begin

        date1 := copy( params.Values[ 'date1' ], 4 );
        date1 := copy( date1, 7,2 )
                +FormatSettings.DateSeparator
                +copy( date1, 5,2 )
                +FormatSettings.DateSeparator
                +copy( date1, 1,4 );

        date2 := copy( params.Values[ 'date2' ] , 4 );
        date2 := copy( date2, 7,2 )
                +FormatSettings.DateSeparator
                +copy( date2, 5,2 )
                +FormatSettings.DateSeparator
                +copy( date2, 1,4 );

        dataSet.close;
        dataSet.ParamByName('date1').AsDate   := strToDate( date1 );
        dataSet.ParamByName('date2').AsDate   := strToDate( date2 );
        dataSet.Open;
        jsonString := '';
        while not dataSet.Eof do begin
            jsonString := jsonString+'{'
                        + 'event:"'+dataSet['event']+'"'
                        + ',start:"'+formatDateTime( 'yyyy-mm-dd',dataSet.FieldByName('fech').asDateTime )+'"'
                        + ',end:"'+formatDateTime( 'yyyy-mm-dd',dataSet.FieldByName('fech').asDateTime )+'"'
                        + '},';
            dataSet.next;
        end;
        uniSession.AddJS(
            'frmBitacora.touchCalendar.view.eventStore.setData(['
            +copy(jsonString,1,length(jsonString)-1)
            +'])'
        );
    end;
end;
 

Link to comment
Share on other sites

Is this what you had in mind ?

 

function tap(sender, e, eOpts)
{
  frmBitacora.touchCalendar.setViewMode('day');
  
  setTimeout(function()
  {
    frmBitacora.touchCalendar.view.innerElement.setStyle({transform:""});
  }, 50);
    
}
 
If so it makes no difference.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...