flex - save state of a dataGrid: visible columns, columns width and order -


i want save remotely (on database) state (visible columns, columns width , order) of flex3 datagrid.

for width , visibility can save them accessing each column attribute.. ugly possible.. order? have create datagrid dynamically??

any idea appreciated thanks

in case have saved order header name (i'm making assumption datagrid has same columns , header names).

        (var n:number = 0; n< datagrid.columns.length; n++)         {             var thiscol:datagridcolumn = datagridcolumn(datagrid.columns[n]);             colarray.additem(thiscol.headertext);         } 

then can restore column order retrieving ordered list of column headers, , swapping position of columns in datagrid required.

        (var n:number = 0; n < colarray.length; n++)         {             movecolumnto(string(colarray.getitemat(n)), n);         } 

i have defined function movecolumnto() perform switch.

        private function movecolumnto(columnname:string, columnindex:number):void         {             // find current column position             var i:number = -1;             (var n:number = 0; n < datagrid.columns.length; n++)             {                 if (datagridcolumn(datagrid.columns[n]).headertext == columnname)                 {                     = n;                     break;                 }             }              if (i == -1 || == columnindex) return; // don't shift column              this.mx_internal::shiftcolumns(i, columnindex); // shift column required position         } 

Comments

Popular posts from this blog

unicode - Are email addresses allowed to contain non-alphanumeric characters? -

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -