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
135
Show Header and Add Row button if datasource is empty
posted

Hello,

I can't find a way to show the grid if there is no data. I want to do this so the user can click the "Add Row" button to add a row just as if they were viewing a populated grid.

Is this possible?? If so, how??

Thanks.

  • 20255
    Offline posted

    Hello,

    I'm just checking do you need further assistance.

  • 20255
    Offline posted

    Hello,

     Thank you for your post!

     You can show the grid if there is no data, although will be shown only the headers of the columns, and you need to define them first like:

    1. $("#grid").igGrid({
    2.                 columns: [
    3.                         {
    4.                             headerText: "Name",
    5.                             key: "Name"
    6.                         },
    7.                         {
    8.                             headerText: "Age",
    9.                             key: "Age",
    10.                         }],
    11.                 autoGenerateColumns: false,
    12.                 dataSource: noData
    13.             });

     Currently it is not possible to show the grid or its headers if autoGenerateColumn is set to true and if you didn't set some datasource. I have create you a sample to show you this approach.

     If you need further assistance on this matter, contact me.

    EmptyDataSource.zip