jQuery Migration deprecated functions.

jQuery Migration deprecated functions.

RobertKohutRobertKohut Posts: 1Questions: 0Answers: 0
edited June 2013 in DataTables 1.9
I'm currently in the process of migrating to the jQuery 1.9.1. During this process I'm cleaning up all of the code in my repository and using jQuery Migrate to find and replace deprecated functions.

https://github.com/jquery/jquery-migrate/blob/master/warnings.md#jqmigrate-jqueryfnattrselected-may-use-property-instead-of-attribute

Line 2777 jquery.dataTables.js version 1.9.4 is currently currently using .attr("selected", true). The latest jQuery 1.9+ should have these methods/functions changed to .prop().

It's a quick fix, but I'm currently running DataTables on a CDN.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    This has been done in git already. v1.10 is I think now more or less beta ready, but I've still got a ton of documentation and tests to write before it can be released - however this will be fixed in that release.

    Allan
  • catequilcatequil Posts: 5Questions: 0Answers: 0
    edited June 2013
    Allan,
    I am running into an issue that might be solved by this same update to jQuery 1.9+. In asp.net there is a updatepanel tag that essentially makes it so the table can be updated by ajax. However, when the table is updated by ajax all of the datatable functionality stops/clears. It might get solved if there was a setting to use a live (old jQuery syntax) of the datatable.

    ie jQuery 1.6 and below used to allow $(".dataTable").live("click", function () {});
    however 1.7+ now has to be written $(selectedContainer).on("click", ".dataTable", function () {});

    I believe, not 100% positive, that by allowing DataTables to use this functionality, probably as a setting, then those developers using updatepanel will be able to configure datatables to see the change and reapply the datatable functionality with the new data. This would probably work for other scenarios where datatables does not do the ajax functionality and some other framework does that functionality.

    Do you think that this would be possible?
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I don't quite understand I'm afraid - are you proposing a change to DataTables? Why not just alter the jQuery code as you have suggested?

    Allan
  • catequilcatequil Posts: 5Questions: 0Answers: 0
    edited June 2013
    The functionality has to be inside the $("").dataTables(); function on whether to do live events for the datatable itself. This is not a change to jQuery. It is a change to Datatables to be able to apply the datatable functionality as it is being changed in the html page. It is similar to datatables ajax functionality except some other external framework is doing the ajax calls. By allowing the live events, datatables would recognize that the table has changed from an ajax call from a separate framework and re apply the datatables functionality. Does that make sense?

    The examples above are the code that you have to write for jQuery to realize that the dom has changed and to automatically re-apply the event handlers.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    It sounds like you are taking about DOM mutation events, which is not supported in DataTables as it has hardly any support in the standard browsers. If you want to change the data in a DataTable, you need to use the DataTables API - otherwise DataTables can't know that you've changed something (this is regardless of jQuery version).

    Can you link me to a test page showing what you've got with the old jQuery? That might help me understand.

    Allan
This discussion has been closed.