Janex Posted August 15, 2014 Share Posted August 15, 2014 Hi. How can I catch grid refresh button push ? I need dataset full refresh when I push refresh button .... WBR Janex Link to comment Share on other sites More sharing options...
adragan Posted August 15, 2014 Share Posted August 15, 2014 Refresh the query behind the dbgrid ! Link to comment Share on other sites More sharing options...
Janex Posted August 15, 2014 Author Share Posted August 15, 2014 Refresh the query behind the dbgrid ! No, this is not good way for me, because then I must add new button for refresh, but integrated in grid refresh button I cannot remove I cannot say to users :"Push this button, newer push button in grid" . I found ext event function store.refresh(sender, eOpts), but this event fire every time when data is loading, not only when refresh button is pressed Link to comment Share on other sites More sharing options...
joriolm Posted August 15, 2014 Share Posted August 15, 2014 I assume you're using a UDBGrid? If that's the case, you can: UDBGrid.Refresh; Link to comment Share on other sites More sharing options...
Janex Posted August 15, 2014 Author Share Posted August 15, 2014 I assume you're using a UDBGrid? If that's the case, you can: UDBGrid.Refresh; Yes, UDBGrid, but I need to refresh dataset and reload data into grid exactly via push refresh button on grid, but when I press refresh button on grid, grid reload data from dataset without dataset data refreshing ... there is the problem. Link to comment Share on other sites More sharing options...
joriolm Posted August 15, 2014 Share Posted August 15, 2014 Do you have a UDBNavigator? Only UDBGrid paged and refresh button? If you have UDBNavigator, user refresh Dataset from there, then in dataset event AfterRefresh you call UDBGrid.Refresh; That refresh button in UDBGrid, IMHO, was not designed for refresh the datasource. Farshad can correct me with this. Regards. Link to comment Share on other sites More sharing options...
Janex Posted August 15, 2014 Author Share Posted August 15, 2014 I have only UDBGrid paged with refresh button. I will when push refresh button, not only old data ir refetched from dataset, but refetched fresh data (with dataset refreshing)... Without UDBNavigator. Without any other additional button. Exactly via UDBGrid refresh button. Link to comment Share on other sites More sharing options...
Sherzod Posted August 18, 2014 Share Posted August 18, 2014 Hi. How can I catch grid refresh button push ? I need dataset full refresh when I push refresh button .... WBR Janex Hi Janex. I think you can override the "refresh": UniDBGrid1 -> .... function afterrender(sender, eOpts) { sender.pagingBar.getComponent("refresh").handler = function () { //your custom logic... alert("test"); } } Best regards. Link to comment Share on other sites More sharing options...
Janex Posted August 18, 2014 Author Share Posted August 18, 2014 Super!!! :-) Thanks, good solution for me, it work, yeeeeeee :-) Link to comment Share on other sites More sharing options...
Wicket Posted November 3, 2017 Share Posted November 3, 2017 *Bump* I too want a way of calling a total refresh when the DBGrid "refresh" button is clicked. How would you call a dataset close and dataset open within the block below. I have it working so it shows "test", but how to access the datasets on the form and call the required methods. Is this even possible? function afterrender(sender, eOpts) { sender.pagingBar.getComponent("refresh").handler = function () { //your custom logic... alert("test"); } } Also can someone explain what this button on the grid does? It obviously doesn't refresh the underlying dataset, I am correct in saying it just refreshes the grid? Thanks, Dan. Link to comment Share on other sites More sharing options...
Sherzod Posted November 3, 2017 Share Posted November 3, 2017 Hi, Try this: 1. UniDBGrid1 -> ClientEvents -> ExtEvents -> function afterrender: function afterrender(sender, eOpts) { var me = sender; if (me.pagingBar) { me.pagingBar.getComponent("refresh").handler = function() { ajaxRequest(me, '_refresh', []) } } } 2. UniDBGrid1 -> OnAjaxEvent: procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = '_refresh' then begin // your custom logic ShowMessage('refresh'); end; end; Best regards, Link to comment Share on other sites More sharing options...
Wicket Posted November 3, 2017 Share Posted November 3, 2017 Wow that was quick - thanks. PS - Is their any more documentation on this sort of thing, or is it just a case of becoming more familiar with ExtJS? Link to comment Share on other sites More sharing options...
Tokay Posted January 30, 2022 Share Posted January 30, 2022 Hi, I found an issue with use of this code: function afterrender(sender, eOpts) { var me = sender; if (me.pagingBar) { me.pagingBar.getComponent("refresh").handler = function() { ajaxRequest(me, '_refresh', []) } } } It interferre with PagingToolbarResizer from this topic while open form: http://forums.unigui.com/?app=core&module=system&controller=content&do=find&content_class=forums_Topic&content_id=4210&content_commentid=73856 JS Error: Cannot read properties of null (reading 'get') Does it possible to use both codes together? Thank you! Version 1551 Link to comment Share on other sites More sharing options...
Sherzod Posted January 30, 2022 Share Posted January 30, 2022 41 minutes ago, Tokay said: JS Error: Cannot read properties of null (reading 'get') Does it possible to use both codes together? Thank you! Version 1551 Hello, Can you please make a simple testcase to check? Link to comment Share on other sites More sharing options...
Tokay Posted January 30, 2022 Share Posted January 30, 2022 That it PageSizeExtension.7z Link to comment Share on other sites More sharing options...
Sherzod Posted January 31, 2022 Share Posted January 31, 2022 Ok. I will check. Link to comment Share on other sites More sharing options...
Sherzod Posted January 31, 2022 Share Posted January 31, 2022 6 hours ago, Tokay said: PageSizeExtension.7z 57.13 kB · 1 download One possible solution. 1. function beforerender(sender, eOpts) { if (sender.pagingBar) { sender.removeDocked(sender.pagingBar, true); sender.addDocked({ dock: 'bottom', items: [Ext.create('Ext.PagingToolbar', { pageSize: sender.store.pageSize, store: sender.store, displayInfo: true, displayMsg: 'Visualizando {0} - {1} de <b>{2}</b>', emptyMsg: "Não há registros", id: sender.id + 'pBar', plugins: Ext.create('Ext.ux.PagingToolbarResizer', { displayText: 'Registros por página', options: [25, 50, 100, 150, 200] }) })] }); } } 2. function afterrender(sender, eOpts) { var me = sender; var pBar = Ext.getCmp(me.id+'pBar'); if (pBar) { pBar.getComponent("refresh").handler = function() { ajaxRequest(me, '_refresh', []) } } } 2 Link to comment Share on other sites More sharing options...
Tokay Posted January 31, 2022 Share Posted January 31, 2022 Your fixes works, thank you! 1 Link to comment Share on other sites More sharing options...
Recommended Posts