jquery.schedule icon indicating copy to clipboard operation
jquery.schedule copied to clipboard

Get data from ajax and bind to schedule dynamically

Open tnthieu opened this issue 5 years ago • 3 comments

Hello,

Thank you for your excellent works.

I have a schedule like this var $sc = $("#schedule").timeSchedule({ startTime: "08:00", // schedule start time(HH:ii) endTime: "21:00", // schedule end time(HH:ii) widthTime: 60 * 10, // cell timestamp example 10 minutes timeLineY: 32, // height(px) verticalScrollbar: 20, // scrollbar (px) timeLineBorder: 2, // border(top and bottom) bundleMoveWidth: 6, // width to move all schedules to the right of the clicked time line cell rows: {} }); I have a service that will return the schedule of people (Title Area in your example). I want to bind the data to your schedule control from ajax call. What should I do? $.ajax({ type: "POST", url: ProjectProperties.ajaxUrlPrefix + "/JeopardyService.svc/GetSchedules", contentType: "application/json; charset=utf-8", dataType: "json", data: JSON.stringify({ jobId: jobId }), contentType: 'application/json; charset=utf-8', success: function (result) { if (result && result.schedules) { ??????????????????????????? //What should I do here? } } });

Furthermore, the json format of the rows is a little bit strange for me also.

{ '0' : { title : 'Title Area', schedule:[ { start:'09:00', end:'12:00', text:'Text Area', data:{ } }, { start:'11:00', end:'14:00', text:'Text Area', data:{ } } ] }, '1' : { title : 'Title Area', schedule:[ { start:'16:00', end:'17:00', text:'Text Area', data:{ } } ] } }

How could you generate it by WCF in ASP.NET. How you create class and serialize the data on server?

Thank you very much

tnthieu avatar Mar 05 '20 22:03 tnthieu

oh I found it. Just an array of json. Thank you for your wonderful works

if (result && result.d) { debugger; var technicianSchedules = JSON.parse(result.d);

                //$("#schedule").timeSchedule('addRow', 0, technicianSchedules[0]);

                var $sc = $("#schedule").timeSchedule({
                    startTime: "08:00", // schedule start time(HH:ii)
                    endTime: "21:00",   // schedule end time(HH:ii)
                    widthTime: 60 * 10,  // cell timestamp example 10 minutes
                    timeLineY: 32,       // height(px)
                    verticalScrollbar: 20,   // scrollbar (px)
                    timeLineBorder: 2,   // border(top and bottom)
                    bundleMoveWidth: 6,  // width to move all schedules to the right of the clicked time line cell
                    rows: technicianSchedules
                });
            }

tnthieu avatar Mar 06 '20 16:03 tnthieu

Hello

How can I reload data with filter criteria?

I tried to $("#schedule").timeSchedule('resetRowData'); $("#schedule").timeSchedule('resetData');

then resetup the schedule, but the schedule did clean all the old data and append new schedule into the old one.

please help

Thanks

tnthieu avatar Mar 07 '20 20:03 tnthieu

You now have to manage the data filters yourself. Demo pages may help you.

https://ateliee.github.io/jquery.schedule/demo/

ateliee avatar Mar 09 '20 01:03 ateliee