jquery - datatables column width issue -
i have many listing page , 1 js file configuring datatables set up. sending value of aocolumns each listing page common js file datatables logic written. have written function in 1 of listing page like:
public function assignedtomehidesort() { return array( "{bsortable: false}", "null", "null", "{bsortable: false}", "null", "null", "null", "null", "null", "null", "null", "null", "null", "null", "null", "null", "null", "null", "{\"bsortable\": false}" ); } $aocolumn = assignedtomehidesort(); echo '<input type="hidden" name="aocolumn" id="aocolumn" value="' . implode(",", $aocolumn) . '">';
then in common js file have written like:
if ($('#aocolumn').val()) { var ao = []; var aos = $('#aocolumn').val().split(','); (var = 0; < aos.length; i++) { if (aos[i] == 'null') { //no need processing ao.push('{ null }'); } else { //remove {, } , whitespace, return array splitted : var s = aos[i].replace('{', '').replace('}', '').replace(' ', '').split(':'); //create object var o = {}; //here need force real boolean instead of "false" o[s[0].tostring()] = (s[1] == "false") ? false : true; ao.push(o); } } } var otable = $('#data-table').datatable({ "sdom": 'ct<"clear">firtlip', "otabletools": { "sswfpath": basepath + "/js/extras/tabletools/media/swf/copy_csv_xls_pdf.swf", "abuttons": [ {"sextends": "csv", "sfilename": curpath + ".csv", "sbuttontext": "save csv", "mcolumns": "visible"} ] }, "aasorting": [ [0, "desc"] ], "bautowidth": false, "alengthmenu": [ [10, 25, 50, -1], [10, 25, 50, "all"] ], "idisplaylength": 10, "olanguage": { "ssearch": "filter : " }, "aocolumns": ao, 'spaginationtype': 'full_numbers' });
but in listing page column width showing 100px. want change , vary column column. have added aocolumndefs
after aocolumns
swidth
property. not working. please guide me how solve width issue.
thanks in advance.
Comments
Post a Comment