javascript - jquery : add option value in array object -


i using jquery datatables , have 2x table aocolumns option , 1x without aocolumns

so want following

if(aocolumns != false) add option in array 

i tried didnt work

function data_table_function(file,language,serverparams,row_call_back,pagation,columns_sort,aocolumndefs){ var  options_data_table = {};  options_data_table = {         "bprocessing": true,         "bserverside": true,         "sajaxsource": file,         "spaginationtype": "full_numbers",         "bpaginate": true,         "olanguage": language,          "idisplaylength": 25,          "alengthmenu": [             [10, 25, 50, 100, -1],             [10, 25, 50, 100, "الكل"]         ],         "fnserverparams": serverparams,         "aasorting": [[ 0, "desc" ]],         "fnrowcallback": row_call_back,         "fndrawcallback": pagation,         "binfo": false,         "aocolumndefs":aocolumndefs     };      if(columns_sort)     options_data_table.push("aocolumns" : columns_sort);       return  options_data_table; } 

options_data_table object, not array:

options_data_table["aocolumns"] = columns_sort; 

or

options_data_table.aocolumns = columns_sort;   

should work.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -