Jump to content

How to change DBGrid Paging bar Language on runtime


emin

Recommended Posts

How can I change the expressions that appear in the dbgrid subsection according to the language chosen by the user?
I found a similar thread on the forum, but I need to do this directly in code instead of clientevents. Because there are multiple language options 

Quote

 

 

Link to comment
Share on other sites

34 minutes ago, emin said:

How can I change the expressions that appear in the dbgrid subsection according to the language chosen by the user?
I found a similar thread on the forum, but I need to do this directly in code instead of clientevents. Because there are multiple language options 

Hello,

When starting the application? Or will the "texts" also change at runtime?

Link to comment
Share on other sites

How can I change these configs at runtime

Quote

These configs:

beforePageText 'of {0}'
afterPageText  'Page'
firstText      'First Page' 
lastText       'Last Page'
nextText       'Next Page'
prevText       'Previous Page' 
refreshText    'Refresh'

 

Link to comment
Share on other sites

8 minutes ago, emin said:

While the form is being created

For example:

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  with UniDBGrid1 do
    if WebOptions.Paged then
      ClientEvents.UniEvents.Values['pagingBar.beforeInit'] := 'function pagingBar.beforeInit(sender, config){'+
      '    config.afterPageText = "of {0}";'+
      //
      '}'

end;

 

Link to comment
Share on other sites

I try to use like this, but doesn't work

Quote

 with UniDBGrid2 do
    if WebOptions.Paged then
      ClientEvents.UniEvents.Values['pagingBar.beforeInit'] := 'function pagingBar.beforeInit(sender, config){'+
      '    config.displayMsg = "Displaying {0} - {1} of {2}";'+
      //
      '}';

 

Link to comment
Share on other sites

Finally I solved the problem. It was my bad. I forgot to clean clientevents. Thanks for your patience and support 

Quote

with UniDBGrid2 do
 if WebOptions.Paged then
 ClientEvents.UniEvents.Values['pagingBar.beforeInit'] :=
 'function pagingBar.beforeInit(sender, config){'+
 'sender.displayInfo = true;'+
 ' sender.displayMsg = sender.displayMsg = " xxxx {0} - {1} / {2} ";'+
 'config.beforePageText = "'+yyy+'";'+ '}';

 

  • Upvote 1
Link to comment
Share on other sites

  • 6 months later...
17 minutes ago, ygerdel said:

Hi, what I need is to get the current page number that is being displayed in the pagination bar of the grid (page 1 of 10, page 2 of 10) to use elsewhere in the system.
Thank you

 

CurrPage = UniDBGrid1.DataSource.DataSet.RecNo div UniDBGrid1.WebOptions.PageSize + 1

I found this in another post and it works perfect.

Thank you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...