DataTables / DataTablesSrc

DataTables source repository
https://datatables.net
MIT License
637 stars 425 forks source link

Change in behavior breaks existing applications #256

Open recursivetree opened 10 months ago

recursivetree commented 10 months ago

Problem

The commit added in https://github.com/DataTables/DataTablesSrc/commit/24d3cb989a447239fb2480734a456c28418cfd73 makes it so that if the ajax.url option is set to an empty string, no data is loaded. This is a breaking change compared to the old behavior where it would just load the data from the current page.

We used this extensively to serve html when the page was queried via GET, but return the data when it is queried with POST.

Suggested Fix

Either revert the commit in question, or provide an option to disable the new behavior.

AllanJard commented 10 months ago

Hi - thanks for noting this. I'll add to the release notes for v2 that this is a breaking change. What to do is:

ajax: {
  url: window.location.pathname,
  type: 'POST'
}

instead of having url: ''.

recursivetree commented 10 months ago

I am not aware that we ever upgraded to version 2. We are using packagist to pull the latest version, see https://packagist.org/packages/datatables.net/datatables.net. Internally, this seems to pull from https://github.com/DataTables/Dist-DataTables. Packagist shows no version labels, but the npm packages linked in the Dist-DataTables repo seem to have version 1.13.8 as the latest version.

Therefore, my question is whether packagist is supposed to serve version 2 or not?

AllanJard commented 10 months ago

DataTables 2 hasn't been released yet (I was mildly surprised to see you were using DT2 your bug report came in!).

The nightly builds have DT2 available, which pulls from the repo you link to, but the current release version of 1.13.8 doesn't have the change noted. It would appear that packagist is using the latest code in git rather than working with the release versions. I don't understand why that is - looking at what references I can find about it, it should be picking up the tags such as 1.13.8.

I'm going to have to ask the packagist folks about this - apologies.

AllanJard commented 10 months ago

Actually I think I've got it - it is because I've got an explicit version tag in the composer.json file, which I shouldn't! Damn sorry - working on a fix for that atm.

AllanJard commented 10 months ago

Opened this issue to see if we can get release tags added.

recursivetree commented 10 months ago

We are using dev-master as the dependency version since packagist doesn't show any other version, so it does indeed pull from master.