New kendo sheduler events don't call controller methods -
i'm trying add new scheduler event database. it's added scheduler datasource , visible in scheduler, isn't call controller create method. edit or delete newly added event don't call controller methods, change datasource.
already exists events work well.
model:
public class resourceschedulermodel : ischedulerevent { public string title { get; set; } public datetime start { get; set; } public datetime end { get; set; } public string description { get; set; } public bool isallday { get; set; } public string recurrencerule { get; set; } public string recurrenceexception { get; set; } public string endtimezone { get; set; } public string starttimezone { get; set; } public int bts_id { get; set; } public resourceschedulermodel() { } public resourceschedulermodel(busytimeslot bts) { bts_id = bts.bts_id; start = bts.bts_from; end = bts.bts_to; title = bts.bts_name; description = bts.bts_description; resid = bts.bts_res_id; } }
controller methods:
public virtual jsonresult read([datasourcerequest] datasourcerequest request) { entitywrapper ew = new entitywrapper(); list<busytimeslot> btss = ew.getallbusytimeslots(); list<resourceschedulermodel> sm = new list<resourceschedulermodel>(); foreach (busytimeslot b in btss) sm.add(new resourceschedulermodel(b)); return json(sm.todatasourceresult(request)); } public virtual jsonresult destroy([datasourcerequest] datasourcerequest request, resourceschedulermodel task) { if (modelstate.isvalid) { // delete } return json(new[] { task }.todatasourceresult(request, modelstate)); } public virtual jsonresult create([datasourcerequest] datasourcerequest request, resourceschedulermodel task) { if (modelstate.isvalid) { //add } return json(new[] { task }.todatasourceresult(request, modelstate)); } public virtual jsonresult update([datasourcerequest] datasourcerequest request, resourceschedulermodel task) { if (modelstate.isvalid) { // edit } return json(new[] { task }.todatasourceresult(request, modelstate)); }
view:
@(html.kendo().scheduler<schedulertry.models.resourceschedulermodel>() .name("scheduler") .date(new datetime(2014, 10, 11)) .minortickcount(1) .views(views => { views.dayview(); views.weekview(weekview => weekview.selected(true)); views.monthview(); views.agendaview(); }) .datasource(d => d .model(m => { m.id(f => f.bts_id); m.field(f => f.title).defaultvalue("no title"); }) .read("read", "resource") .create("create", "resource") .destroy("destroy", "resource") .update("update", "resource") ) )
in addition, when try close or cancel edit window of new event error
uncaught typeerror: cannot read property 'bts_id' of undefined kendo.all.min.js:11
try updating bts_id below intialization below:
public int bts_id; public string bts_id { { return bts_id; } set { bts_id = value; } }
Comments
Post a Comment