fiqs8stwme6s806a

welcome to my space

Remove Columns from a grid

  • Hi,

    is there a way to completly remove columns from a grid? I have the problem if i set columns hidden, that they are shown up again if i add columns and reconfigure the grid. When i reconfigure i tell ext to not hide them because every new column must show up. I do not want another array where i save the already hidden columns. And another thing is that the grid gets really slow if i add some more columns.

    Thanks...


  • ;) Yeah. I Solved it like this now:


    var newFields = new Array();

    for (var i = 0; i < fields.length; ++i) {
    if (fields[i].name != 'm1_'+ gId) {
    newFields.push({name: fields[i].name});
    }
    }
    fields = newFields;


    never tought that it was so simple :)


  • Yeah, thought of that. That means i have to go over the array again and splice out the elemnts that i don't want to have. I thougt that there were a simpler way to to that, like an extensions or a workaround.


  • Obviously, this is just symantics, but I am a huge fan of Ext.each over general for loops


    var newFields = ; //new array shortcut

    Ext.each(fields, function(field, index, allFields) {
    if (field.name != 'm1_'+ gId) {
    newFields.push({name: field.name});
    }
    });
    fields = newFields;


  • if you add columns, why not remove the ones you want to from your column model definition?


  • Why not reconfigure the grid with a columnmodel that doesn't contain the column?

    (or did you also wanted to remove the field from the store?)


  • Eh, it's not too hard to do what you want to do ;).







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Remove Columns from a grid , Please add it free.
    edit

    Mexico