Meteor and Editor DataTables and Inline Edit
Meteor and Editor DataTables and Inline Edit
hhsiao
Posts: 12Questions: 4Answers: 0
Hi Alen,
I've been successful in implementing inline edit with Meteor. Problem is I can only do it once, after which I get following failure:
jquery.js:1491 Uncaught Error: Syntax error, unrecognized expression: #ObjectID("5746ce5e7f64dd8e5dc0ac85")
Can you explain to me exactly what I should pass into successCallback?
Regards,
Henry
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi Henry,
The JSON return from the server is documented here - that JSON is what should be given to the success callback in
ajax
.The error you are seeing occurs if a selector is used with characters that have special meaning. For example in the above, it sounds like that whole string (
ObjectID("5746ce5e7f64dd8e5dc0ac85")
) is what has been applied as your row ids. Is that correct?Allan
I believe the purpose of the JSON is for Editor to properly update the display?
I am running Meteor,
ObjectID("5746ce5e7f64dd8e5dc0ac85")
is the Mongo DB id column.I am actually using https://github.com/aldeed/meteor-tabular which automatically updates the display in reaction to any data changes, so I think that makes the passing of JSON redundant.
Is there way to skip this portion of the update? I got it working currently but it is completely ghetto (described below):
Soo... the above actually gets me exactly what I want... I however kinda feels a bit dirty for doing such a ghetto hackery.
Can you strip the
ObjectID("")
part? That would make it a valid ID selector.Allan
I just realize what I did with re-initializing only works for inline editing, not bubble editing.
My data looks like:
The field _id gets displayed (but hidden) on the datatable, when you say strip, do you mean from the backend? or purely just the frontend? I'll continue to poke around at this, I feel like I am getting closer to actual solutions :)
Hi Allan,
Great news, your suggestion worked!! I simply created a new field that doesn't use ObjectId.
For anyone else that happen to find this thread. The exact fix is:
All insert into Mongo DB have a "uid" field, where the values goes like this:
db.ResourceSchedule.insert({"uid":ObjectId().str, resourceName: "Alice"})
After which use uid for the editor idSrc: 'uid',
Thanks again Allan!
That's awesome - thanks for posting back with your solution!
Regards,
Allan
@hhsiao , how did you integrated editor with meteor tabular? Can you please help me for the same. Please share sample code if possible.
@soclbz: @hhsiao: I am trying to do the same with the Meteor framework. Can you let me know where you included the datatables.editor.js file?
I am also using the aldeed, meteor-tabular and want it to play well with it.
Thanks so much.