Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
Hide/Unhide Column funktion
posted

Hi there,

in my project i use a navigation bar for filtereing the grid-content by the name of  a habour. I try to hide the column with the harbour-names when a  harbour is selected und unhide it when "all" is chosen:

function showHabour(hafen){
if(hafen == "Alle"){
                $("#MyGrid").igGridFiltering('filter', ([
                { fieldName: "Harbor", expr: hafen, cond: "doesNotEqual"}
 
                ]));
                $("#MyGrid").igGridHiding([{ columnKey: "Harbor", hidden: false }]);
            }
            else{
                $("#MyGrid").igGridFiltering('filter', ([
                { fieldName: "Harbor", expr: hafen, cond: "contains"}
 
                ]));
                $("#MyGrid").igGridHiding([{ columnKey: "Harbor", hidden: true }]);
            }
}
unfortunately this does not work...
can anybody help me whith this?

Best Andy
  • 1235
    posted in reply to Andreas Basse

    Hello Andreas,

    To hide/show a column there are igGridHiding functions - hideColumn and showColumn. For example:


    if(hafen == "Alle") {
        $("#MyGrid").igGridFiltering("filter", [{ fieldname: "Harbor", expr: hafen, cond: "doesNotEqual" }]);
        $("#MyGrid").igGridHiding("showColumn", "Harbor");
    } else {
        $("#MyGrid").igGridFiltering("filter", [{ fieldname: "Harbor", expr: hafen, cond: "contains" }]);
        $("#MyGrid").igGridHiding("hideColumn", "Harbor");

    Please feel free to contact me if you have further questions.

    Regards,
    Ivaylo Hubenov
    Entry-level developer

  • 110
    posted

    sorry, some parts of my code seeme to be hidden in the window above:

    if(hafen == "Alle"){
          $("#MyGrid").igGridFiltering('filter', ([{ fieldName: "Harbor", expr: hafen, cond: "doesNotEqual"}]));
          $("#MyGrid").igGridHiding([{ columnKey: "Harbor", hidden: false }]);
         }
       else
        {
          $("#MyGrid").igGridFiltering('filter', ([{ fieldName: "Harbor", expr: hafen, cond: "contains"}]));
          $("#MyGrid").igGridHiding([{ columnKey: "Harbor", hidden: true }]);
         }
    }