JavaScript Disable updating a Dojo Grid

I Have four grids in Dojo, all of which update with real time data every few seconds.

I only display one grid to the user at a time, but in the background all four grids update. This makes the page slow down a lot on a mobile device (not noticeable on a PC).

Is there a way to disable updating a grid if it's not in view?

var myGrid = new (declare([Grid, DijitRegistry]))({
    store: myStore, // this is a Observable(Memory())
    columns:[
        {field: "field1", label: "A", sortable: false},
        {field: "field2", label: "B", sortable: false},
        {field: "field3", label: "C", sortable: false},
        {field: "field4", label: "D", sortable: false},
        {field: "field5", label: "E", sortable: false}
    ],
    selectionMode: "single",
    cellNavigation: true,
    queryOptions: {
        sort:[{attribute: "field1", descending: true}]
    }
},
    myDomRef
);

is there something like

myGrid.disable();

and

myGrid.enable();

so that DOM updating only occurs if the Grid is enabled?

Answer:1

If you are using dgrid 0.3.17 or dgrid 0.4.0, there are options to enable/disable observation, but they only take effect at the time a store or collection is set.

In dgrid 0.3.17, the property is shouldObserveStore:

grid.set('shouldObserveStore', false);
grid.set('store', ...);

In dgrid 0.4.0, the property is shouldTrackCollection:

grid.set('shouldTrackCollection', false);
grid.set('collection', ...);
Answer:2

I am trying to dynamically create a simple select which contains an object's property as the option based on some constraints. Everything works fine when my JSON is a part of the script. FIDDLE The ...

I am trying to dynamically create a simple select which contains an object's property as the option based on some constraints. Everything works fine when my JSON is a part of the script. FIDDLE The ...

I use rails 4. The problem that I have is when I follow the links in my rails app - some js libraries doesnt't work(jquery.inview.js , ckeditor/init). When I refresh page - everything works just fine. ...

I use rails 4. The problem that I have is when I follow the links in my rails app - some js libraries doesnt't work(jquery.inview.js , ckeditor/init). When I refresh page - everything works just fine. ...

  1. rails doesn't scale
  2. rails table doesn't exist
  3. rails c doesn't work
  4. rails server doesn't work
  5. rails console doesn't start
  6. rails object doesn't support #inspect
  7. rails s doesn't work
  8. rails console doesn't work
  9. rails new doesn't work
  10. rails server doesn't start
  11. rails includes doesn't work
  12. rails save doesn't work
  13. rails generate doesn't work
  14. rails destroy doesn't work
  15. rails javascript doesn't work
  16. rails command doesn't work
  17. rails ajax doesnt work
  18. rails permit doesn't work
  19. rails ckeditor doesn't work
  20. rails uniq doesn't work

Here's a CodePen of what I'm trying to achieve: http://codepen.io/golfecholima/pen/GJqEOm It's a little audio bug that sits in the bottom right corner. When a user scrolls past a certain element on ...

Here's a CodePen of what I'm trying to achieve: http://codepen.io/golfecholima/pen/GJqEOm It's a little audio bug that sits in the bottom right corner. When a user scrolls past a certain element on ...

  1. why does audio stop when screen recording
  2. why does audio stop
  3. why does my audio stop working

This is a quasi follow-up of Detect version of Java using JavaScript I have the restriction that the javascript should not initialize the java plugin (also not use deployJava, which in turn uses the ...

This is a quasi follow-up of Detect version of Java using JavaScript I have the restriction that the javascript should not initialize the java plugin (also not use deployJava, which in turn uses the ...

  1. find java version linux
  2. find java version mac
  3. find java version windows
  4. find java version cmd
  5. find java version on windows 10
  6. find java version mac terminal
  7. find java version ubuntu
  8. find java version of jar
  9. find java version from class file
  10. find java version installed
  11. find java version in terminal
  12. find java version in unix
  13. find java version linux command
  14. find java version using cmd
  15. find java version on pc
  16. find java version command
  17. find java version intellij
  18. find java version powershell
  19. find java version mac os
  20. find java version in eclipse