igGrid - make hidden grid visible

by georgianastasov

HTML

<script src="https://igniteui.com/js/modernizr.min.js"></script>
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
<script src="https://cdn-na.infragistics.com/igniteui/latest/js/infragistics.core.js"></script>
<script src="https://cdn-na.infragistics.com/igniteui/latest/js/infragistics.lob.js"></script>
<script src="https://igniteui.com/js-data/northwind"></script>
<link href="https://cdn-na.infragistics.com/igniteui/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet"></link>
<link href="https://cdn-na.infragistics.com/igniteui/latest/css/structure/infragistics.css" rel="stylesheet"></link>

<div id="grid-wrapper" style="height: 0px; visibility: hidden;">
  <table id="grid"></table>
</div>
<input type="button" id="btn" value="Show The Grid" style="margin-top:1rem;"/>

JavaScript

$(function () {
            $("#grid").igGrid({
                primaryKey: "EmployeeID",
                width: '100%',
                height : "600px",
                columns: [
                    { headerText: "Employee ID", key: "EmployeeID", dataType: "number", width: "15%" },
                    { headerText: "First Name", key: "FirstName", dataType: "string", width: "25%" },
                    { headerText: "Last Name", key: "LastName", dataType: "string", width: "25%"},
                    { headerText: "Title", key: "Title", dataType: "string", width: "35%" }
                ],
                autofitLastColumn: false,
                autoGenerateColumns: false,
                dataSource: northwind,
                responseDataKey: "results",
                features: [
                    {
                        name: "Sorting",
                        type: "local",
                        mode: "multi",
                        sortingDialogContainment: "window"
                    },
                    {
                        name: "Filtering",
                        type: "local",
                        filterDialogContainment: "window"
                    },
                    {
                        name: "Hiding"
                    },
                    {
                        name: "ColumnMoving",
                        columnMovingDialogContainment: "window"
                    },
                    {
                        name: "Summaries"
                    },
                    {
                        name: "Updating"
                    }
                ]
            });
            
            $("#btn").igButton({
                labelText: $("#btn").val(),
                click: function (e)
                {
                		$("#grid-wrapper").css('height', '600px');
                		$("#grid-wrapper").css('visibility', 'visible');
                }
            });
        });