Jump to content

Grid refresh button


Janex

Recommended Posts

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

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

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

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

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

  • 3 years later...

*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

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

  • 4 years later...

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

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', [])
        }
    }
}

 

  • Like 2
Link to comment
Share on other sites

×
×
  • Create New...