Jump to content

Recommended Posts

Posted

Hello!

Is there a nearly proper way to set UniDBGrid WebOptions.PageSize depending on theme, font, grid header height etc. or get RowHeight from theme's css. I found a solution in the forum but it does not make a perfect solution:
  iPageSize:=Round((UniDBGrid.Height-80)/(21*23)*23);
  UniDBGrid.WebOptions.PageSize := iPageSize;
  UniSession.AddJS(
    UniDBGrid.JSName+'.getStore().pageSize='+IntToStr(iPageSize)+';'+
    UniDBGrid.JSName+'.getStore().load({params: { limit: '+IntToStr(iPageSize)+' }});'+
    UniDBGrid.JSName+'.getView().refresh();'
  );

Thanks in advance

Posted

Hello,

Just to clarify: even if we dynamically calculate the row height, what would you consider to be the correct way to determine the PageSize?
Should it exactly fit the visible height of the grid, or are you aiming for a visually balanced result depending on the theme and font?

Posted
17 hours ago, Sherzod said:

Hello,

Just to clarify: even if we dynamically calculate the row height, what would you consider to be the correct way to determine the PageSize?
Should it exactly fit the visible height of the grid, or are you aiming for a visually balanced result depending on the theme and font?

Hello!

I know it is a complicated question. So It would be near perfect to know the header height ( with filter bar or not ) and rowheight depending on the theme to calculate pagesize.  I think most of the cases is enough for grids without grouping and without multiline rows. Thanks in advance

 

 

 

 

Posted
On 4/29/2025 at 1:42 PM, Sherzod said:

Hello,

Just to clarify: even if we dynamically calculate the row height, what would you consider to be the correct way to determine the PageSize?
Should it exactly fit the visible height of the grid, or are you aiming for a visually balanced result depending on the theme and font?

 

Ok. I'll trying to find out something.

 

Posted

I tought something like this, but I'm not an UniGUI expert:

 

function afterrender(grid) {
     var view = grid.getView();
    var rowEl = view.getNode(0);
    var rowHeight = rowEl ? Ext.fly(rowEl).getHeight() : 26;

    var gridHeight = grid.getHeight();
    var headerHeight = grid.headerCt ? grid.headerCt.getHeight() : 28;

    var pager = grid.getDockedItems('pagingtoolbar[dock="bottom"]')[0];
    var pagerHeight = pager ? pager.getHeight() : 32;

    var extraPadding = 6;

    var usableHeight = gridHeight - headerHeight - pagerHeight - extraPadding;
    var pageSize = Math.floor(usableHeight / rowHeight) - 1;
    if (pageSize < 1) pageSize = 1;

    ajaxRequest(grid, 'SetPageSize', ['pageSize=' + pageSize]);
    
}

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