Draw all the rows at a time from the dataset in dataview

Posted by: ralvee on 27 September 2017, 4:48 pm EST

    • Post Options:
    • Link

    Posted 27 September 2017, 4:48 pm EST

    Hi

    I would like to print the spread view content just like it is drawn.

    dataView = new GC.Spread.Views.DataView(document.getElementById('grid1'), data, columns,
        new GC.Spread.Views.Plugins.GridLayout());
    

    I have noticed spread views does not draw all the elements from the dataset. When I scroll, it draws certain number of rows at a time. Can I customise the number of rows drawn? Or Can I get the all the rows drawn based on the given dataset? I need it to print the content of spread view using html canvas. Or is there any better way to print from the dataview?

    Thanks

  • Posted 29 September 2017, 2:46 am EST

    Hello,

    You can set the loadOnDemand feature to ‘False’ in order to not load rows as scrolled. For example:

    dataView.options.loadOnDemand = false;

    Thanks,

    Deepak Sharma

  • Posted 2 October 2017, 1:46 pm EST

    Hi Deepak

    It does not work. I think you are referring this from live loading

    https://www.grapecity.com/en/demos/spread/JS/ViewsDemo/#/demos/LiveLoading

    But I dont want live loading. I just want to specify the number of rows to be drawn when spread view (i.e. dataView) loads.

  • Posted 2 October 2017, 3:29 pm EST

    Hello,

    There is no such API for rendering entire content, if you want to print(render) all records at once, one option is to specify a big enough container. If that’s not what you want and you just want to get all render info (HTML), here is a tricky way, hope that helps

    1. declare a hidden container
    <div style="display:none">
              <div id="grid1"></div>
    </div>
    
    1. rewrite the built-in getContainerInfo_ method and return a right size to display all records. Views will measure the container size by calling window.getComputedStyle and it will return height = 0 if the container display is none, the other option is use a hidden (visibility: hidden) container with a right size and you don’t need rewrite getContainerInfo_ method in that case.
    var dataView = new GC.Spread.Views.DataView(document.getElementById('grid1'), data, new GC.Spread.Views.Plugins.GridLayout());
           
    var handler = {
                    apply: function(target, thisArgs, argumentList){
                        return { contentRect: {top:0, left:0, height:2000,width:1000}};
                    }
         
     
            }; 
          dataView.gCI_ = new Proxy(dataView.gCI_,handler );
          dataView.invalidate();
          var viewportHtml = document.getElementById('grid1').outerHTML;
    

    Hope it helps.

    Thanks,

    Reeva

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels