bServerSide with sAjaxDataProp == ""

bServerSide with sAjaxDataProp == ""

ericbuckleyericbuckley Posts: 1Questions: 0Answers: 0
edited August 2011 in Bug reports
When the following 2 conditions are true:
[code]
bServerSide: true
sAjaxDataProp == ""
[/code]

I believe you need to alter the _fnAjaxUpdateDraw() to take this into account. Below is a patch I am proposing.

[quote]
3544,3546c3544,3550
<
< var fnDataSrc = _fnGetObjectDataFn( oSettings.sAjaxDataProp );
< var aData = fnDataSrc( json );
---
>
> var aData = json;
> if ( oSettings.sAjaxDataProp !== "" )
> {
> var fnDataSrc = _fnGetObjectDataFn( oSettings.sAjaxDataProp );
> aData = fnDataSrc( json );
> }
[/quote]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I hadn't actually anticipated sAjaxDataProp being an empty string, so I'm not too surprised that doesn't work perhaps quite as expected at the moment. Its a nice idea though - just being able to get an array back and use that. I wonder if null would be better than an empty string, but either way, that sounds like a good plan and something I'll include in 1.8.2.

    Regards,
    Allan
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    One point that has just struck me - if you are using server-side processing, you need to be able to pass back sEcho, iTotalRecords and so on, but if you are just returning an array this wouldn't work. With server-side processing, you must return an object - while with client-side processing but an Ajax source, then this is 100% valid, and actually DataTables already does this :-)

    Regards,
    Allan
This discussion has been closed.