rgreat Posted February 20, 2018 Share Posted February 20, 2018 TopRow? BottomRow? And how to get updates on these? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 21, 2018 Share Posted February 21, 2018 Hi, We will analyze this Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 22, 2018 Share Posted February 22, 2018 Hi, it's a first draft: function beforeInit(sender, config) { var me = sender; me._getFirstVisibleRow = function() { i = 0; me.store.each(function(rec) { ss = Ext.fly(me.normalGrid.view.getNode(rec, true)); sd = ss.getTop() - (me.el.getTop() + me.normalGrid.getHeaderContainer().getHeight() - (ss.getHeight() / 2)); if (sd < 0) { i += 1; } else { return false; } }); return i; }; me._getLastVisibleRow = function() { i = 0; me.store.each(function(rec) { ss = Ext.fly(me.normalGrid.view.getNode(rec, true)); sd = ss.getTop() - (me.el.getTop() + me.normalGrid.getHeaderContainer().getHeight() - (ss.getHeight() / 2)); if (sd < me.normalGrid.view.el.getHeight()) { i += 1; } else { return false; } }); return i; }; } Best regards, Quote Link to comment Share on other sites More sharing options...
rgreat Posted February 26, 2018 Author Share Posted February 26, 2018 ss = Ext.fly(me.normalGrid.view.getNode(rec, true)); normalGrid - undefined If i just remove "normalGrid" then code only works on 1-st page of the grid. UniGUI - 1.0.2.1438 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 26, 2018 Share Posted February 26, 2018 Hi, ** How can i get visual range of UniStringGrid? Sorry, do you use UniStringGrid or UniDBGrid ? Quote Link to comment Share on other sites More sharing options...
rgreat Posted February 26, 2018 Author Share Posted February 26, 2018 UniStringGrid Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 26, 2018 Share Posted February 26, 2018 OK, but what do you mean by saying: "only works on 1-st page of the grid" ?! Quote Link to comment Share on other sites More sharing options...
rgreat Posted February 26, 2018 Author Share Posted February 26, 2018 Handing rowModel.select: function rowModel.select(sender, record, index, eOpts) { alert(sender.grid._getFirstVisibleRow()+' '+sender.grid._getLastVisibleRow()); } Working while TopRow = 0 then i scroll grid down, so TopRow > 0 ss = Ext.fly(me.view.getNode(rec, true)); ss = null so ss.getTop() raises an error. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 26, 2018 Share Posted February 26, 2018 OK, I will check it 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 28, 2018 Share Posted February 28, 2018 Hi, OK, I will check it then i scroll grid down, so TopRow > 0 ss = Ext.fly(me.view.getNode(rec, true)); ss = null so ss.getTop() raises an error. Please can you make a simple testcase for this if possible,it seems I couldn't reproduce this Quote Link to comment Share on other sites More sharing options...
rgreat Posted March 5, 2018 Author Share Posted March 5, 2018 Sorry for delay, but StringGrid shows very inconstant behaviour. It must give alert with TopRow/BottomRow values on cell selection change. Just try to browse the grid (top and bottom parts) and you will see. Also test buttons will give errors if clicked in sequence. If i use BeginUpdate/EndUpdate in InitGrid function (see example) it glitches a bit different but still glitched. sgtest.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 5, 2018 Share Posted March 5, 2018 Hi, Also you can try to use this approach (maybe you need to optimize and adjust to some extent): function select(sender, record, index, eOpts) { //alert('Top: '+sender.grid._getFirstVisibleRow()+', Bottom: '+sender.grid._getLastVisibleRow()); firstRowIndex = 0; lastRowIndex = 0; var me=sender.grid; startIndex = me.view.all.startIndex; endIndex = me.view.all.endIndex; for (i = startIndex; i < endIndex; i++) { if ((Ext.get(me.view.getRow(i)).getTop() - me.headerCt.getHeight() - Ext.get(me.view.getRow(i)).getHeight()) >= 0) { firstRowIndex = i; break; }; }; for (i = startIndex; i < endIndex; i++) { if ((Ext.get(me.view.getRow(i)).getTop() - me.headerCt.getHeight()) > me.view.getHeight()) { lastRowIndex = i; break; }; }; alert('Top: '+firstRowIndex+', Bottom: '+lastRowIndex); } Best regards, 1 Quote Link to comment Share on other sites More sharing options...
rgreat Posted March 6, 2018 Author Share Posted March 6, 2018 It works. Thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.