Notice: Undefined index: sEcho (sEcho is passed in request though)
Notice: Undefined index: sEcho (sEcho is passed in request though)
Fogest
Posts: 7Questions: 1Answers: 0
Upon trying to sort or filter data from a Datatable using the server_side processing script on the example page, I am given the following error:
[quote]Notice: Undefined index: sEcho[/quote]
And the JSON output returned is:
[quote]{"sEcho":0,"iTotalRecords":"2","iTotalDisplayRecords":"2","aaData":[["DC2610","3"],["DC2611","3"]]}[/quote]
This does not make sense to me, because according to the network tab of Chrome, when I try to sort the data a request is handed off with sEcho being equal to 2 as seen below:
[quote]http://localhost/people-app/products/auxRoom.php?sEcho=2&sColumns=room%2Ccapacity&iDisplayStart=0&iDisplayLength=25&sSearch=&iSortCol_0=1&sSortDir_0=asc&iSortingCols=1&ajax=products&visibleColumns=0%2C1 [/quote]
The above is made in the form of a GET request. If it matters I am using the Yii framework, though I don't think that is related. I am using the exact code from the server side scripting example, with the MySQL info changed of course (including columns).
Any reason why this may not be working?
Edit:
I am using Datatables and here are the settings that should be being used currently:
[code]
$.fn.eDataTables.defaults = {
jqxhr: null,
ajaxUpdate: [],
pagerClass: 'pager',
loadingClass: 'loading',
filterClass: 'filters',
tableClass: 'items',
selectableRows: 1,
editableSelectsRow: true,
relatedOnlyOption: false,
ajaxOpts: {},
bProcessing: true,
bServerSide: true,
bStateSave: false,
bAutoWidth: false,
bJQueryUI: true,
sPaginationType: "full_numbers",
//aaSorting: [[0, "asc"]],
iDisplayLength: 25,
editable: {
string: {},
integer: {},
boolean: {}
},
buttons: {},
filterForm: null,
filterSerializeCallback: function(f){return f.serializeArray();}
};
[/code]
Ajax call is made later.
[quote]Notice: Undefined index: sEcho[/quote]
And the JSON output returned is:
[quote]{"sEcho":0,"iTotalRecords":"2","iTotalDisplayRecords":"2","aaData":[["DC2610","3"],["DC2611","3"]]}[/quote]
This does not make sense to me, because according to the network tab of Chrome, when I try to sort the data a request is handed off with sEcho being equal to 2 as seen below:
[quote]http://localhost/people-app/products/auxRoom.php?sEcho=2&sColumns=room%2Ccapacity&iDisplayStart=0&iDisplayLength=25&sSearch=&iSortCol_0=1&sSortDir_0=asc&iSortingCols=1&ajax=products&visibleColumns=0%2C1 [/quote]
The above is made in the form of a GET request. If it matters I am using the Yii framework, though I don't think that is related. I am using the exact code from the server side scripting example, with the MySQL info changed of course (including columns).
Any reason why this may not be working?
Edit:
I am using Datatables and here are the settings that should be being used currently:
[code]
$.fn.eDataTables.defaults = {
jqxhr: null,
ajaxUpdate: [],
pagerClass: 'pager',
loadingClass: 'loading',
filterClass: 'filters',
tableClass: 'items',
selectableRows: 1,
editableSelectsRow: true,
relatedOnlyOption: false,
ajaxOpts: {},
bProcessing: true,
bServerSide: true,
bStateSave: false,
bAutoWidth: false,
bJQueryUI: true,
sPaginationType: "full_numbers",
//aaSorting: [[0, "asc"]],
iDisplayLength: 25,
editable: {
string: {},
integer: {},
boolean: {}
},
buttons: {},
filterForm: null,
filterSerializeCallback: function(f){return f.serializeArray();}
};
[/code]
Ajax call is made later.
This discussion has been closed.
Replies
Allan
Notice: Undefined index: bSortable_1 in C:\wamp\www\people-app\products\auxRoom.php on line 60
Any idea what may be wrong?
[quote]{"sEcho":2,"iTotalRecords":"30","iTotalDisplayRecords":"30","aaData":[["DC2635","13"],["DC2636","14"],["DC2637","14"],["DC2638","15"],["DC2639","15"]]} [/quote]
I also receive this console error:
[quote] Uncaught TypeError: Cannot read property 'length' of undefined [/quote]
Can you link me to the page please, I'm not exactly sure what is going wrong.
Allan