How to scroll mygrid with buttons

Helllo!

I trie to scroll my table with button, and I use the csrollTop function but I can find wich div is scrollable into mygrid.

This code works my other divs:

      top_man=0;
      inc_man=100;

    $("#btnGridManUp").bind("click", function() {
        if(top_man-inc_man>0){
          $("#dhtmlxGridmanuctsMan").find(".objbox").scrollTop(top_man-inc_man);
          top_man=top_man-inc_man;
        }else if(top_man-inc_man<=0){
          top_man=0;
          $("#dhtmlxGridmanuctsMan").find(".objbox").scrollTop(top_man);
        }
      });
      $("#btnGridManDown").bind("click", function() {
        scroll_height=$("#dhtmlxGridmanuctsMan").find(".objbox").prop("scrollHeight")-$("#dhtmlxGridmanuctsMan").find(".objbox").height();
        if(top_man+inc_man<scroll_height){
          $("#dhtmlxGridmanuctsMan").find(".objbox").scrollTop(top_man+inc_man);
          top_man=top_man+inc_man;
        }else if(top_man+inc_man>=scroll_height){
          top_man=scroll_height;
          $("#dhtmlxGridmanuctsMan").find(".objbox").scrollTop(top_man);
        }
      });

This topic same as my lat topic but I don’t know how can I delete my topics.

Does somebody know how can scroll the grid with buttons?

You may try to use showRow() method scroll a row to a visible area
docs.dhtmlx.com/doku.php?id=dhtm … ct_showrow

To get currently visible rows you may try to use getStateOfView() method
docs.dhtmlx.com/doku.php?id=dhtm … tateofview

I tried to what you suggested but i have 17 row in my grid, 5 row visible, and when i scroll the end of grid end the state[0](top row id) = 27.

Any Idea???

So again:

I have 17 rows in my grid but when i use the getStateOfView() function and scroll to bottom of the grid, the result is:
state[0]=25
state[1]=16
state[2]=17

Please tell me why?

If paging mode is enabled:
state[0] = number of current active page
state[1] = index of the top row in the page
state[2] = index of the last row in the page
state[3] = number of rows in grid

If paging mode is disabled:
state[0] = index of the top visible row
state[1] = height of the visible area in rows
state[2] = number of rows in grid

If issue still occurs - please, provide a sample of your code with the dataset so we can reproduce the issue.


var ar_man = [[1,"Globo Lighting S.R.O."],[2,"Rábalux Kft."],[3,"a"],[4,"B"],[19,"Tzsv"],[6,"D"],[7,"F"],[8,"L"],[9,"Á"],[10,"Y"],[11,"T"],[12,"A"],[13,"w"],[14,"asfd"],[15,"reg"],[16,"vdfv"],[17,"safer"],[18,"asdffer"],];

function doInitGrid(){
    mygrid_man = new dhtmlXGridObject("dhtmlxGridProductsMan");
    mygrid_man.setImagePath("images/dhtmlx/")
    mygrid_man.setHeader("ID,Gyártó");
//    if (ar_man.length<7){
      mygrid_man.setInitWidths("0,300");
//    }else{
//      mygrid_man.setInitWidths("0,280");
//    }
    mygrid_man.setColAlign("center,center");
    mygrid_man.setColTypes("ro,ro");
    mygrid_man.enableAlterCss("even_row","odd_row");
    mygrid_man.init();
    mygrid_man.parse(ar_man,"jsarray");
    mygrid_man.setStyle("background-color:rgb(255,205,25);font-size:28px;font-weight:bold","color:white;font-size:22px;padding-top:10px;padding-bottom:10px","","background-color:rgb(205,205,205);color:red;");
    mygrid_man.makeFilter("txbProductsManSearch",1);
    mygrid_man.attachEvent("onRowSelect", function(id,ind){
      $("#txbProductsManSearch").val(mygrid_man.cells(id,ind).getValue());
      var e = jQuery.Event("keydown");
      e.which = 40; // # Some key code value
      $("#txbProductsManSearch").trigger(e);
    });
}
doInitGrid();

[code]

Szűrő:
Fel /\Le \/
[/code] [code] $("#btnGridManUp").bind("click", function() { var state=mygrid_man.getStateOfView(); alert(state[0]+","+state[1]+","+state[2]+","+state[3]); }); [/code]

#dhtmlxGridProductsMan{ height:355px; width:300px; border-left:1px solid rgb(255,205,25); border-right:1px solid rgb(255,205,25); } #btnGridManUp,#btnGridManDown{ width:140px; margin-left:5px; margin-right:5px; height:50px; font-size:38px; }

Here is the complete demo file with the problem.
Scroll the grid and push the "Fel/" button!
demo.zip (95.5 KB)

I found why get state wrong numbers:

I use the mygrid.setStyle property and I change the row height with font-size:28px;height:32px;
but the getStateView calculate the default row height.

How can I solve it?