jQWidgets Forums
Forum Replies Created
-
Author
-
Thanks Peter, do you have any thoughts on how we can dynamically add an appointment without requiring a re-bind and repositioning of the users view?
Is there a knockout based approach where we just modify the appointment collection and it pulls in the new list without an explicit re-bind?
Thanks
Hi Peter, I’m piggybacking on this thread because I have a similar question. We are updating the scheduler display from an external source using SignalR and re-binding. This works, it reloads the scheduler but the screen returns to the top so any user that has scrolled down to somewhere in the middle has now lost their place.
Is there a way to re-bind but maintain the users viewable area or scroll position?
Thanks.
Happy to see it’s working for you evgen_2411. I would still like someone from jqWidgets to confirm if this is the correct approach or if I’m just reinventing a more complicated wheel for something that can be achieved much easier. I guess more importantly are there holes in this approach where data could be lost or invalid.
Hi Guys, I’m trying to accomplish the same thing, add a new input to the edit Dialog. Here’s what I came up with so please correct me if I’m completely off base with how to approach this.
As evgen_2411 started I added a new property to my appointment “newF”
var appointment1 = { id: "id1", description: "", location: "", subject: "Test Subject", res: "Room 5", newF: "TEST", start: new Date(2015, 10, 23, 8, 0, 0), end: new Date(2015, 10, 23, 8, 30, 0) }
Next I added the new field to the datafields
dataFields: [ { name: 'id', type: 'string' }, { name: 'description', type: 'string' }, { name: 'location', type: 'string' }, { name: 'subject', type: 'string' }, { name: 'res', type: 'string' }, { name: 'allDay', type: 'boolean' }, { name: 'start', type: 'date' }, { name: 'end', type: 'date' }, { name: 'newF', type: 'string' } ],
And then mapped it in the appointmentDataFields as “newfield”
appointmentDataFields: { from: "start", to: "end", id: "id", description: "description", location: "location", subject: "subject", allDay: "allDay", resourceId: "res", newfield: "newF" },
Now is where it gets messy (IMO)
In order to add my new field to the dialog I first created the HTML elements in the body after the scheduler div<div id="scheduler"></div> <div id="test"> <div class="jqx-scheduler-edit-dialog-label">New Field</div> <div class="jqx-scheduler-edit-dialog-field"><input type="text" id="input1" /></div> </div>
Then I used jQuery to position the field immediately above the buttons in the “editDialogCreate” function
editDialogCreate: function (dialog, fields, editAppointment) { $("#dialogscheduler").children().last().before($("#test")); },
Now when opening the dialog I need to populate the input with the field from the appointment object
editDialogOpen: function (dialog, fields, editAppointment) { $("#input1").val(editAppointment.newfield); },
Finally, I used the appointmentChange event to save the input box data back to the appointment object
$("#scheduler").on('appointmentChange', function (event) { var args = event.args; var appointment = args.appointment; appointment.newfield = $("#input1").val(); });
I think that’s it. It seems to work so far but it’s only a proof of concept right now however it feels like there should be an easier way to do this. Any suggestions woudl be appreciated.
Thanks
-
AuthorPosts