Forums

Forums / Developing Portals / Subgrid Hide/ Show

Subgrid Hide/ Show

Thread is closed for posting
2 posts, 1 answered
  1. Krishna Hari
    Krishna Hari avatar
    65 posts
    Registered:
    05 Dec 2019
    Answered
    28 Jan 2020
    Link to this post
    I am trying to write a function to hide / show the grid if there is no data in it. It works to hide . it works on the console. but the funtion is not getting ececuted properly . 

    function Grid() 
    {
        var grid = tpc.page.subgrid.get_grid();
        grid.dataSource.fetch();
        var count = grid.dataSource.total();
        if (count == 0)
        {
            tpc.page.subgrid.hide();
        }
        if (count >= 1)
        {
            tpc.page.subgrid.show();
        }

    }
    What am i doing wrong?
        
  2. Omar S
    Omar S avatar
    51 posts
    Registered:
    04 Jul 2019
    03 Feb 2020 in reply to Krishna Hari
    Link to this post
    Hello Krishna
    Before you can fetch your data, you need to call the databound event. There is a simple example here:  

    https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/events/databound
     
    Hope this helps. 
    Last modified on 03 Feb 2020 16:02 by Omar S
2 posts, 1 answered