jQWidgets Forums

jQuery UI Widgets Forums Angular jqxGrid ensurerowvisible

This topic contains 2 replies, has 2 voices, and was last updated by  Gary 8 years, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • jqxGrid ensurerowvisible #93078

    Gary
    Participant

    When invoking the ” ensurerowvisible ” method on jqxGrid in grid settings as follows:

    gridSettings: jqwidgets.GridOptions = {
    ready: function () {
    this.myGrid.ensurerowvisible(0);
    },
    width: ‘99.5%’,
    height: this.innerHeight,
    source: this.dataAdapter,
    pageable: false,
    autoheight: false,
    sortable: true,
    altrows: false,
    theme: ‘energyblue’,
    enabletooltips: true,
    editable: false,
    editmode: ‘singlerow’,
    scrollbarsize: 15,
    selectedrowindex: this.selectedAccountRowIndexValue,
    columns: [

    I get the following error:

    ERROR Error: Uncaught (in promise): TypeError: Cannot read property ‘ensurerowvisible’ of undefined
    TypeError: Cannot read property ‘ensurerowvisible’ of undefined
    at a.(anonymous function).ready (http://localhost:4200/main.bundle.js:8539:28)
    at k (eval at webpackJsonp.6.module.exports (http://localhost:4200/scripts.bundle.js:434:8), <anonymous>:7:30487)
    at a.jqx.dataview.dataview.update (eval at webpackJsonp.6.module.exports (http://localhost:4200/scripts.bundle.js:434:8), <anonymous>:7:31237)
    at d (eval at webpackJsonp.6.module.exports (http://localhost:4200/scripts.bundle.js:434:8), <anonymous>:13:25341)

    Running with Angular 4.0.0, JQWIDGETS: 4.5.1, TypeScript: 2.2.0

    Gary

    jqxGrid ensurerowvisible #93086

    Ivo Zhulev
    Participant

    Hi Gary,

    This is because Angular needs first to render the component before you have access to it. There are several ways to bypass that, but the most easy one is to put this in some Angular lifecycle method like AfterViewInit:

    ngAfterViewInit(): void {
       this.myGrid.ensurerowvisible(0);
    }
    

    Best Regards,
    Ivo

    jQWidgets Team
    http://www.jqwidgets.com/

    jqxGrid ensurerowvisible #93098

    Gary
    Participant

    Works…

    Thanks,
    Gary

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.