Change the parameter added to aoData and send to the server
Change the parameter added to aoData and send to the server
Hallo Allan,
thanks for your great tool!! I use it with out any problem an it work excellent stable. In this case i add some parameter to the aoData-array in the fnserverData-function an init-time. The request and result work fine also the search. Now i must change the added parameters because the user have change his requirements from frontend. I think i can modify the array aoData when use the variable oTmpSetting=oTBExample.fnSetting(). But aoData includs the Records from the first/last request. Also the aoPreSearchCols-Array includes all columns and there paramters but not the parameter i added. So i studdy your tools more intensiv and found the function _fnAjaxUpdate which create the aoData-array form the aoPreSearchCols-array to send to the server. But there is also no way to change these parameters. With the function fnAjaxReload i can only change the ajaxrequest but nut the aoData-array. So i try to call the fnServerData function manually, like oTBExample.fnServerData(... but without success.
Where is my bug ?
To give me a solution her a codesnippet from my code at init-time:
[code]
"bServerSide": true,
"bProcessing": true,
"bStateSave": false,
"sAjaxSource": oITK.getHost('wissen_suche', 'path')+"wissen_suche_mitarbeiter.php",
"fnServerData": function ( sSource, aoData, fnCallback ){
aoData.push({"name": "fil_1_wissen_id", "value": "0"});
aoData.push({"name": "fil_1_level", "value": "0"});
aoData.push({"name":"fil_1_vgl_operator", "value":""});
aoData.push({"name": "fil_1_vkn_operator", "value": ""});
aoData.push({"name": "AnzCheckedWissen", "value": "0"});
$.getJSON( sSource, aoData, function (json){
fnCallback(json)
});
},
[/code]
thanks in advance
joachim
thanks for your great tool!! I use it with out any problem an it work excellent stable. In this case i add some parameter to the aoData-array in the fnserverData-function an init-time. The request and result work fine also the search. Now i must change the added parameters because the user have change his requirements from frontend. I think i can modify the array aoData when use the variable oTmpSetting=oTBExample.fnSetting(). But aoData includs the Records from the first/last request. Also the aoPreSearchCols-Array includes all columns and there paramters but not the parameter i added. So i studdy your tools more intensiv and found the function _fnAjaxUpdate which create the aoData-array form the aoPreSearchCols-array to send to the server. But there is also no way to change these parameters. With the function fnAjaxReload i can only change the ajaxrequest but nut the aoData-array. So i try to call the fnServerData function manually, like oTBExample.fnServerData(... but without success.
Where is my bug ?
To give me a solution her a codesnippet from my code at init-time:
[code]
"bServerSide": true,
"bProcessing": true,
"bStateSave": false,
"sAjaxSource": oITK.getHost('wissen_suche', 'path')+"wissen_suche_mitarbeiter.php",
"fnServerData": function ( sSource, aoData, fnCallback ){
aoData.push({"name": "fil_1_wissen_id", "value": "0"});
aoData.push({"name": "fil_1_level", "value": "0"});
aoData.push({"name":"fil_1_vgl_operator", "value":""});
aoData.push({"name": "fil_1_vkn_operator", "value": ""});
aoData.push({"name": "AnzCheckedWissen", "value": "0"});
$.getJSON( sSource, aoData, function (json){
fnCallback(json)
});
},
[/code]
thanks in advance
joachim
This discussion has been closed.
Replies
if i got your problem right:
you could use javascript variables for the aoData.push() instead of your hardcoded values.
[code]
var datatablePushValue1 = "0";
oTable = $('#tableDiv').dataTable( {
"bServerSide": true,
"bProcessing": true,
"bStateSave": false,
"sAjaxSource": oITK.getHost('wissen_suche', 'path')+"wissen_suche_mitarbeiter.php",
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push({"name": "fil_1_wissen_id", "value": datatablePushValue1});
$.getJSON( sSource, aoData, function (json){
fnCallback(json)
});
}
[/code]
I guess, that there are elements at the frontend. Just add some onchange="setValue()" function, which changes the value of the javascript variable and calls oTable.fnDraw();
I don't know, if it is a good approach, but it works. I use this with onclick events on protovis pie chart wedges to display the datasets according to the selected wedges - works like a charm.
Best regards
Stephan M