Jump to content

Recommended Posts

Posted

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!

Posted
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
Posted

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

Posted
7 minutes ago, Rafael P said:

After delete some data, the Grid Refresh to the first page.

Hello Rafael,

Please make a complete testcase to check.

Posted
59 minutes ago, Sherzod said:

Hello Rafael,

Please make a complete testcase to check.

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

problema melhor exemplificado.gif

DBListGrid.rar

Posted
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;

 

Posted
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

Posted
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?

Posted
8 minutes ago, Rafael P said:

Sorry, no. But i will, and as soon as i get i'll test.

Thanks anyway!!

Thanks. Also I will try to give you another solution...

Posted
10 minutes ago, Sherzod said:

Thanks. Also I will try to give you another solution...

Thank you so much, and sorry to bother you! 

Posted
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;

 

Posted
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

×
×
  • Create New...