javascript - slickgrid - How to loop through rows which are outside canvas? -


i having markers on map , same number of rows in slickgrid?

what want when marker clicked id of marker matched rows , corresponding row should selected.

here code:

var $canvas = $(grid.getcanvasnode()); var $allrows = $canvas.find('.slick-row');      $($allrows).each(function() {         if ($(this).rowid == selectedmarker) {             $(this).addclass("active-row");              grid.scrollrowintoview($(this).index());         }     }); 

it works fine when row want present in grid grid dom contains 8 rows @ time (the grid has 30 rows).

how can loop through data?

you shouldn't modifying slickgrid's dom @ all. slickgrid overwrite changes it's rendering rows in view (with buffer). when scroll past buffer changes made dom lost.

you have change row's data , allow slickgrid add appropriate classes dom when it's rendering.

edit:

slickgrid setup:

dataview.getitemmetadata = metadata(dataview.getitemmetadata);  function metadata(metadataprovider) {   return function(row) {     var item = this.getitem(row),         ret = metadataprovider(row);      if (item && item.isactive) {       ret = ret || {};       ret.cssclasses = (ret.cssclasses || '') + ' active-row';     }      return ret;   }; } 

then when click on marker:

var item = dataview.getitembyid(selectedmarker); var row  = dataview.getrowbyid(selectedmarker); item.isactive = true; dataview.updateitem(item.id, item); grid.scrollrowintoview(row); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -