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
30
Grid Showing Empty row
posted

Hi,

We have configure igGrid with AutoGenerateColumns true.

When the empty Datamodel was bind from mvc grid is showing empty row.

Kindly let me how to show the grid with out empty row if no data available.

Thank you

Code example : 

$('#tGrid').igGrid({
dataSource: "@Html.Raw(Model.GridDataUrlRelativePath)",
DataSourceType: "json",
responseDataKey: "Records",
autoGenerateColumns: true,
autoGenerateLayouts: true,
columns: columnsData,
height: "500px",

  • 485
    Verified Answer
    Offline posted

    Hello Rajesh,

     

    Thank you for posting in our forum.

     

    In order to be sure your issue gets addressed correctly, I would appreciate some additional information regarding your scenario:

     

    1. Only the igHierarchicalGrid has an option “autoGenereateLayouts”, but I see you use it in the provided code snippet. Do you use an igGrid, or an igHierarchicalGrid in your application? If you are using an igGrid, you may remove the option from the configuration – the grid would discard it anyway, as it is not a valid option.
    2. The default value of the “autoGenerateColumns” option is “true”, so there is no need to explicitly set it again. Please note that if you pass any columns, the option would be set to “false” automatically. I see that you pass in a “columnsData” array in the provided snippet. This means that actually you are not using “autoGenerateColumns”, even though you have set it to “true”. What does this "columnsData" array contain?
    3. Do you get an error in the console when the grid gets rendered with a single empty row, and if so – could you please provide the error stack trace?
    4. Please check if the igGrid does not receive a dataSource with a single empty record inside – try inspecting the page source (right click -> View Page Source) in order to see the final html that gets rendered in the browser; or open the “Network” tab in the Dev Tools and inspect the response JSON that you get from the server.
    5. Providing me an isolated sample (if it is possible? ) where this issue reproduces would be greatly appreciated, as it would allow me to debug on my side and find the root cause of the problem.

     

    I look forward to your reply.

  • 485
    Offline posted

    Hello Rajesh,

     

    I am glad that you find my suggestion helpful.

    Feel free to contact me if you have some additional questions regarding this matter.

     

    Thank you for using Infragistics controls.