Jump to content

UnimDBGrid Always Going To The First Page After Refreshing


Recommended Posts

Hi Everyone!

Is there any way to prevent DBGrid from go to the first page of data after refreshing? I mean, if i have 1/4 pages, everytime i delete some row from the page 3 automatically go to the first page (1/4). Then i want to remain in the same page after delete some row of my grid.

Any propertie that i have to change or code in this case?

 

Thanks!

Link to post
Share on other sites
5 hours ago, Rafael P said:

Is there any way to prevent DBGrid from go to the first page of data after refreshing?

Hello,

What do you mean by saying "after refreshing"?

  • Like 1
Link to post
Share on other sites

Hello Sherzod. 

After delete some data, the Grid Refresh to the first page. I will attach some example bellow.

Actually i'm trying to refresh the label of Grid down below. I mean, when i delete some data, automatically the grid refresh and go to the first page, and the label down the screen keeps remain the last page. 

I will attach the code that i using too in the DbGrid -> ExtEvents -> Store.load.

I'm following these tips from Mhmda and unfortunatelly i have found these problem.

 

 

problema.gif

Capturar.PNG

Link to post
Share on other sites
10 hours ago, Rafael P said:

Here. I will add the gif too. Try to look at the couting page in example and you will see what i'm trying to explain. :D

Hello Rafael,

Try with these changes:

1. UnimDBListGrid1 -> ClientEvents -> UniEvents ->

function afterCreate(sender) 
{
    sender._updateSlider = function(grid) {
        grid.getDockedItems()[0].hide();
        var slider = grid.down('slider');
        var lbl = MainmForm.lblPaging;
        lbl.setHtml('Page: ' + (slider.getValue() + 1).toString() + '/' + (slider.getMaxValue() + 1).toString());
    };
}

2. UnimDBListGrid1 -> ClientEvents -> ExtEvents ->

function store.load(sender, records, successful, operation, eOpts)
{

}

3. UnimDBListGrid1 -> OnAfterLoad ->

procedure TMainmForm.UnimDBListGrid1AfterLoad(Sender: TUniCustomDBGrid);
begin
  with (Sender as TUnimDBListGrid) do
    JSInterface.JSCall('_updateSlider', [JSControl]);
end;

 

Link to post
Share on other sites
5 hours ago, Sherzod said:

Hello Rafael,

Try with these changes:

1. UnimDBListGrid1 -> ClientEvents -> UniEvents ->


function afterCreate(sender) 
{
    sender._updateSlider = function(grid) {
        grid.getDockedItems()[0].hide();
        var slider = grid.down('slider');
        var lbl = MainmForm.lblPaging;
        lbl.setHtml('Page: ' + (slider.getValue() + 1).toString() + '/' + (slider.getMaxValue() + 1).toString());
    };
}

2. UnimDBListGrid1 -> ClientEvents -> ExtEvents ->


function store.load(sender, records, successful, operation, eOpts)
{

}

3. UnimDBListGrid1 -> OnAfterLoad ->


procedure TMainmForm.UnimDBListGrid1AfterLoad(Sender: TUniCustomDBGrid);
begin
  with (Sender as TUnimDBListGrid) do
    JSInterface.JSCall('_updateSlider', [JSControl]);
end;

 

Hi Sherzod. Unfortunately, UnimDbListGrid don't have AfterLoad Event. Only these options:

 

 

06.PNG

Link to post
Share on other sites
4 minutes ago, Rafael P said:

Unfortunately, UnimDbListGrid don't have AfterLoad Event. Only these options:

Hi Rafael,

Aren't you going to upgrade to the latest build yet?

Link to post
Share on other sites
43 minutes ago, Rafael P said:

I'm using V. 1.90.0.1535

1.

function afterCreate(sender) 
{
    sender._updateSlider = function(grid) {
        grid.getDockedItems()[0].hide();
        var slider = grid.down('slider');
        var lbl = MainmForm.lblPaging;
        lbl.setHtml('Page: ' + (slider.getValue() + 1).toString() + '/' + (slider.getMaxValue() + 1).toString());
    };
}

2.

function store.load(sender, records, successful, operation, eOpts)
{
    ajaxRequest(sender.grid, '_afterload', []);
}

3.

procedure TMainmForm.UnimDBListGrid1AjaxEvent(Sender: TComponent;
  EventName: string; Params: TUniStrings);
begin
  if EventName = '_afterload' then
    with (Sender as TUnimDBListGrid) do
      JSInterface.JSCall('_updateSlider', [JSControl]);

end;

 

Link to post
Share on other sites
13 minutes ago, Sherzod said:

1.


function afterCreate(sender) 
{
    sender._updateSlider = function(grid) {
        grid.getDockedItems()[0].hide();
        var slider = grid.down('slider');
        var lbl = MainmForm.lblPaging;
        lbl.setHtml('Page: ' + (slider.getValue() + 1).toString() + '/' + (slider.getMaxValue() + 1).toString());
    };
}

2.


function store.load(sender, records, successful, operation, eOpts)
{
    ajaxRequest(sender.grid, '_afterload', []);
}

3.


procedure TMainmForm.UnimDBListGrid1AjaxEvent(Sender: TComponent;
  EventName: string; Params: TUniStrings);
begin
  if EventName = '_afterload' then
    with (Sender as TUnimDBListGrid) do
      JSInterface.JSCall('_updateSlider', [JSControl]);

end;

 

Once i have start the application using your code, the screen has appear only in Loading mode... 

image.png.eae2716743362d0311bfe1752cacb992.png

Link to post
Share on other sites
×
×
  • Create New...