jQWidgets Forums

jQuery UI Widgets Forums Grid Uncaught TypeError: Cannot read property 'css' of undefined

This topic contains 4 replies, has 2 voices, and was last updated by  Peter Stoev 9 years, 3 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author

  • aleem523
    Participant

    Hi,

    I am using ‘jqxgrid’ with Angular in my application, when I navigate to one of the view where ‘jqxgrid’ is used.

    I can see “Uncaught TypeError: Cannot read property ‘css’ of undefined “ on the console (Debug tool) and runs into infinite loop. causes serious performance issue to the application.

    Here is the script below for your quick reference :

    ` $scope.getExperimentList = function () {
    // Get sources data for experiments grid
    var source = experimentService.getExperimentSource();
    // create data adapter
    var dataAdapter = experimentService.getExperimentDataAdapter(source);
    // Get grid configuration for experiments
    $scope.experiments = experimentService.getExperimentListConfig(dataAdapter, false, false, !isAdmin);

    // Watch on experiment grid data.
    $scope.$watch(function () {
    return $scope.experimentData;
    }, function (n, o) {
    // n = the actual value
    if (n != undefined) {
    $scope.experimentData = n;
    source.localdata = $scope.experimentData;
    $(“#experimentGrid”).jqxGrid({ source: dataAdapter });
    }
    }, true)
    };

    ———————–
    html code :
    <jqx-grid jqx-settings=”experiments” jqx-instance=”grid” id=”experimentGrid”></jqx-grid>


    Peter Stoev
    Keymaster

    Hi aleem523,

    You change the Grid’s source in a watch. If that watch is called multiple times or the data update causes that watch to be called, you will run in infinite loop.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    aleem523
    Participant

    Hey Peter,

    Thank you for the quick response.

    Is there a way to update the jqxGrid data(source) at runtime, after grid initialized?


    aleem523
    Participant

    I just removed grid’s source out of watch block, but still I can see the same error :

    jqxgrid.js:7 Uncaught TypeError: Cannot read property ‘css’ of undefined


    Peter Stoev
    Keymaster

    Hi aleem523,

    Share a jsfiddle.net sample. We do not know what’s this error and what’s the code that caused such error to be raised on your side.

    Best Regards,
    Peter Stoev
    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.