bStateSave does not work with ColReorderWithResize.js

bStateSave does not work with ColReorderWithResize.js

hamid_numjewhamid_numjew Posts: 2Questions: 0Answers: 0
edited February 2013 in General
I have a table that contains client's stock holdings (portfolio). TableTools is used to let clients print/export/copy their holdings. Also Clients can change column orders and column size on the fly. I'm using ColReorderWithResize.js to achieve this. That's all Alright. I'm also using bSatetSave to remember their preferences. On page re-load or page refresh everything works. It remembers number of entries per page, sorted columns and so on. BUT it does not remember client's column order and column resize. Can anybody guide me on how to set this up? or I guess my question should be is this possible?

The code:

[code]
var portfolioItemsArray = new Array(22);
portfolioItemsArray[0] = ["0","OPM","10","1PM PLC","0.09p","0.00p","£0.01","£0.22","£-0.21","B","B194YY1","23"];
portfolioItemsArray[1] = ["1","ABBY","1000","ABBEY PLC","525.00p","0.00p","£5","250.00","£4","025.00","£1,225.00","B","0002040","23"];
portfolioItemsArray[2] = ["2","AAIF","50","ABERDEEN ASIAN INC","221.00p","-0.25p","£110.50","£5.58","£104.92","B","B0P6J83","23"];
portfolioItemsArray[3] = ["3","AZN","140","ASTRAZENECA","2","956.50p","47.50p","£4","139.10","£4","298.96","£-159.86","B","0989529","23"];
portfolioItemsArray[4] = ["4","BIOM","13100","BIOE TECH","0.07p","0.00p","£9.17","£523.22","£-514.05","B","0581419","23"];
portfolioItemsArray[5] = ["5","CCE","10","CAMO CLEA","2.00p","0.13p","£0.20","£13.57","£-13.37","B","B11FB96","23"];
portfolioItemsArray[6] = ["6","CHAR","35","CHARIOT OIL & GAS","27.25p","0.00p","£9.54","£58.00","£-48.46","B","B2R9PM0","23"];
portfolioItemsArray[7] = ["7","ELE","1974","ELECTRIC WORD","1.75p","0.00p","£34.55","£101.00","£-66.45","B","0308362","23"];
portfolioItemsArray[8] = ["8","GKP","1252","GULF KEYS","177.50p","0.75p","£2","222.30","£2","528.52","£-306.22","B","B019X62","23"];
portfolioItemsArray[9] = ["9","HMV","10000","HMV GROUP","1.75p","-0.15p","£175.00","£0.00","£175.00","B","3157572","23"];
portfolioItemsArray[10] = ["10","IMI","10","IMI","1","131.00p","34.50p","£113.10","£100.78","£12.32","B","0457963","23"];
portfolioItemsArray[11] = ["11","JLT","500","JARD LLOYD","780.00p","-9.50p","£3","900.00","£0.00","£3","900.00","B","0520337","23"];
portfolioItemsArray[12] = ["12","JD.","500","JD SPRTS FSHN","688.00p","7.75p","£3","440.00","£3","685.78","£-245.78","B","0477154","23"];
portfolioItemsArray[13] = ["13","LLOY","1785","LLYD BKG","49.76p","1.85p","£888.22","£3","496.94","£-2","608.72","B","0870612","23"];
portfolioItemsArray[14] = ["14","MXP","1000","MAX PET","3.70p","-0.10p","£37.00","£140.64","£-103.64","B","B0H1P66","23"];
portfolioItemsArray[15] = ["15","","10000","OXONICA","0.00p","0.00p","£0.00","£0.00","£0.00","B","B0D09P4","23"];
portfolioItemsArray[16] = ["16","PHTM","10000","PHOTO ME INTL","186.20p","2.80p","£18","620.00","£7.09","£18","612.91","B","0848125","23"];
portfolioItemsArray[17] = ["17","QQ.","10000","QINETIQ GRP","6","220.00p","272.50p","£622","000.00","£18","362.00","£603","638.00","B","B0WMWD0","23"];
portfolioItemsArray[18] = ["18","RRS","1000","RANDGOLD","98.00p","2.33p","£980.00","£10","000.00","£-9","020.00","B","B01C3S3","23"];
portfolioItemsArray[19] = ["19","","3444","RBS","0.00p","0.00p","£0.00","£898.70","£-898.70","B","0754783","23"];
portfolioItemsArray[20] = ["20","RTO","10","RENTOKIL INITIAL","0.00p","0.00p","£0.00","£50.43","£-50.43","B","B082RF1","23"];
portfolioItemsArray[21] = ["21","RBS","1","ROYL BANK","301.60p","7.40p","£3.02","£3.02","£0.00","B","B7T7721","23"];



var oTable = jQuery('#pnlportfolioUK').show().dataTable({
"sDom": 'RT<"clear">lfrtip',
"bStateSave": true,
"aaData" : portfolioItemsArray, /* data already been fetched */
"aoColumns": [
{ "sWidth": "5%", "sTitle": "RowId"},
{ "sWidth": "6%", "sTitle": "Symbol"},
{ "sWidth": "5%", "sTitle": "Qty"},
{ "sWidth": "26%","sTitle": "Description"},
{ "sWidth": "8%", "sTitle": "Price"},
{ "sWidth": "7%", "sTitle": "Price Change"},
{ "sWidth": "9%", "sTitle": "Market Value"},
{ "sWidth": "9%", "sTitle": "Book Cost"},
{ "sWidth": "9%", "sTitle": "Gain/Loss"},
{ "sWidth": "6%", "sTitle": "Corp Action"},
{ "sWidth": "5%", "sTitle": "depot"},
{ "sWidth": "5%", "sTitle": "sedol"}],

"oTableTools": {
"aButtons": [ "copy", "print", "csv", "xls", "pdf"],
"sSwfPath": "http://localhost:8090/hamidTest/swf/copy_csv_xls_pdf.swf"
}
});
[/code]

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Likely ColReorderWithResize doesn't support that - it hasn't been kept up-to-date with the latest changes in DataTables and it will well behind the 'real' ColReorder in terms of features now (minus the resizing obviously).

    ColReorderWithResize is not supported as part of the DataTables project - it is 3rd party software. Any patches to bring it up-to-date are welcome and I'll host it on this site, but it is not maintained as part of DataTables.

    Allan
This discussion has been closed.