Bug if using custom ajax function for edit and/or remove, but there is no create function

Bug if using custom ajax function for edit and/or remove, but there is no create function

paulhickmanpaulhickman Posts: 21Questions: 1Answers: 0

I am using custom functions to provide ajax data for edit, but my table doesn't support creating rows.

In line 3193, the code is:

// Get the correct object for rest style
if ( $.isPlainObject( ajaxSrc ) && ajaxSrc.create ) {
    ajaxSrc = ajaxSrc[ this.s.action ];
}

This implies that ajaxSrc always has a create function if it has any of create/edit/remove defined, which is not necessarily the case.

If your table supports edit and/or remove only and you are providing custom ajax functions, this code will cause a crash further down the function because it wrongly assumes you are using a URL rather than a custom function.

It should be using this.s.aciton to determine whether to test for ajaxSrc.create, ajaxSrc,edit or ajaxSrc.remove being undefined.

This discussion has been closed.