Problem with getting saveState working

Problem with getting saveState working

NfourxNfourx Posts: 1Questions: 1Answers: 0
edited June 2015 in Free community support

Good day!

I inherited a mishmash of code for an internal database handling site in our company and got asked to focus on making it more user friendly, make the tables more customizable and so on.
The whole project is a mash between JS and ASP, features added whenever someone had the need and time to do so. I'm not a very experienced JS nor ASP user so I turn to you guys for some help.
The tables are ASP gridviews but also initiated as dataTables.

So what I wanted to do was to use the ColVis extension and the Savestate to let the users customize which columns they want to show and then save them between sessions. But sadly that is currently not working.

Sadly I won't be able to show everything since it is an internal tool.

But here is the JS code for the Datatable:

 var oTable = $('#dgOverview').dataTable(
            {
                "sDom": '<"H"fCTr><"datatable-scroll"t><"F"ip>',
                "bPaginate": false,
                "aaSorting": [[4, "asc"]],
                "bJQueryUI": true,
                "bScrollCollapse": true,
                "bScrollAutoCss": true,
                "bAutoWidth": false,
                "oColVis":
                {  
                    "aiExclude": [0, 1, 2, 3, 5],
                    "buttonText": "Show / Hide Columns",
                },

                  
                "saveState": true,
                "stateDuration": 60*60*24*31*12,
                "aoColumnDefs":
                [
                    { "bVisible": false, "aTargets": hiddenColumns }
                ],
                   
                "oTableTools": {
                    "sSwfPath": "swf/copy_csv_xls_pdf.swf",
                    "aButtons": [
                        "copy",
                        "xls"
                    ]
               
                },
                
            });

Everything works except for the saveState. So I am just wondering if it something clearly is wrong here or if it might be because it is an ASP page.

Here is the ASP code for the table that is used.

 <asp:GridView ID="dgOverview"
                AutoGenerateColumns="False"
                runat="server"
                AllowSorting="True"
                OnPreRender="dgOverview_PreRender"
                Width="100%"
                OnRowDataBound="dgOverview_RowDataBound">
                <HeaderStyle BackColor="DarkGray" HorizontalAlign="Center"></HeaderStyle>
                <Columns>
                    <asp:TemplateField HeaderText="Select">
                        <ItemTemplate>
                            <asp:CheckBox ID="chkSelected" runat="server" AutoPostBack="False" />
                            <asp:HiddenField ID="hiddenField1" runat="server" Value='<%# Eval("EcuCplId") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField HeaderText="column1" DataField="column2" />
                    <asp:BoundField HeaderText="columnN" DataField="columnN" />
                </Columns>
                <RowStyle CssClass="rowStyle"></RowStyle>
                <HeaderStyle CssClass="headerStyle" />
                <FooterStyle CssClass="footerStyle" />
            </asp:GridView>

Thank you sincerely for any help or insight!

Nfourx

This discussion has been closed.