DataTables Editor DataTime Picker OnChange Event has no data.
DataTables Editor DataTime Picker OnChange Event has no data.
washuit-iamm
Posts: 133Questions: 55Answers: 2
in Editor
Hello, regarding new $.fn.DataTable.Editor.DateTime()
I noticed that the selected date is actually a property on the instance.
This is making some plugin development pretty difficult for us. The OnChange event has no arguments so we can not properly set up hoods with the Editor DateTime Field.
Can you please pass the selected date back when you internally call OnChange?
This question has accepted answers - jump to:
This discussion has been closed.
Answers
I had expected that in instances like this you would just read the value directly from the
input
element that you've assigned for the date time input.Valid point though - it should also be executed in the scope of the instance so you could do
this.val()
. Noted for the next release.Allan
@allan I will appreciate if you will pass another argument specifying the source element on which the DateTime was init (like
that.dom.input
)That makes sense - thanks. I'll look into that as well.
Allan
Thanks, another option could be to pass the value along with the arguments that are sent to the
onChange
, like thisonChange: myFunctionName(event, someData)
either way anything is welcome
Hey, this addition would really be appreciated
Hi,
Little update on this - the next release of Editor will carry this change. DateTime picker's
onChange
callback will now execute in the scope of the date time instance and pass two arguments:Date()
object for the selected date / time.Allan
@allan Will it be possible to tell which dom element was the source of the event?
It wasn't without using the private parameters before, but I've just added a third parameter based on your suggestion - so it's now:
Date()
object for the selected date / time.input
element that triggered this, wrapped by jQueryAllan
Thanks, that will be useful for integration
@allan unrelated to topic and feel free to delete (because I don't know how) but when doing edit and then save comment it duplicates it
Hi @daniel_r ,
I think it's just a temporary wobbly - if you refresh the page I'm only seeing a single comment. Is that the case for you too?
Cheers,
Colin
Yeah its really annoying that. It seems to be a bug in the forum software. A refresh of the page after an edit, as Colin says, is the workaround at the moment.
Allan