estrify Posted February 15, 2017 Share Posted February 15, 2017 Hi, I have a paged dbgrid that has akRight and akBottom anchors. At runtime, when I change PageSize of the grid to adapt its content to the available space after a form resizing, the paging bar does not update its initial parameters. How can I update them?. Sure I am missing something trivial but if not, is there a workaround to achieve this result?? Thanks in advance... Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted February 15, 2017 Administrators Share Posted February 15, 2017 Probably you need to call Refresh method of Grid. Quote Link to comment Share on other sites More sharing options...
estrify Posted February 16, 2017 Author Share Posted February 16, 2017 Probably you need to call Refresh method of Grid. Thanks for response. But by now, this is insufficient... However, I have found a way to workaround this... Please, consider add the dynamic changing of the PageSize as a new feature... By now, here is how to achieve it: dbgrd.WebOptions.PageSize:=iNewPageSize; /* for now this has no effect. Only to be "clean" */ UniSession.AddJS( dbgrd.JSName+'.getStore().pageSize='+IntToStr(iNewPageSize)+';'+ dbgrd.JSName+'.getStore().load({params: { limit: '+IntToStr(iNewPageSize)+' }});'+ dbgrd.JSName+'.getView().refresh();' ); One more question: in UniDBGrid, is there a way to retrieve the total height of headers (considering grouping and so on) and the pager?? Regards, 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 16, 2017 Share Posted February 16, 2017 Hi, Also you can try to use this plugin for now and I think this plugin can be added in future versions: http://forums.unigui.com/index.php?/topic/4210-pagesize-extension-for-unidbgrid/ One more question: in UniDBGrid, is there a way to retrieve the total height of headers (considering grouping and so on) and the pager?? If I understand you correctly, you can get them something like this (on the client side): MainForm.UniDBGrid1.pagingBar.getHeight(); MainForm.UniDBGrid1.headerCt.getHeight(); Best regards. Quote Link to comment Share on other sites More sharing options...
estrify Posted February 16, 2017 Author Share Posted February 16, 2017 Thanks for the answer... The plugin is very useful but I need to adjust paging automatically to the available space exactly ... This is why I need the height of different components to calculate the number of lines to be displayed avoiding to show grid's vertical scroll bar... I have already achieved it... Thanks a lot.. Regards, Quote Link to comment Share on other sites More sharing options...
M477H13U Posted June 8, 2018 Share Posted June 8, 2018 Hello everyones ! Is there a way to get 'UniDBgrid1.store.currentPage' by programmatically ? For now the only solution I found is to make an ajaxRequest with this prop in order to access it in delphi ... Thanks for your time ! (: Edit: Okay I did not really think this through.. it very simple currentPage := Ceil((Recno * total nbr of page) / RecordCount) ... could you add a property "CurrentPage" as there is CurrRow, CurrCol .. ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 8, 2018 Share Posted June 8, 2018 Edit: Okay I did not really think this through.. it very simple currentPage := Ceil((Recno * total nbr of page) / RecordCount) ... could you add a property "CurrentPage" as there is CurrRow, CurrCol .. ? Or something like that: CurrPage = UniDBGrid1.DataSource.DataSet.RecNo div UniDBGrid1.WebOptions.PageSize + 1 Quote Link to comment Share on other sites More sharing options...
M477H13U Posted June 8, 2018 Share Posted June 8, 2018 Yeah, the approach is even simpler ! ^^ What about setting the current page programmatically ? In JS I've seen that UniSession.AddJS(UniDBGrid1.JSName+'.store.loadPage(1);'); is working, but maybe there is a way in delphi ? :3 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.