Jump to content

DBGrid Built-In Navigation Bar: Display When Not In Paged Mode - How


andyhill

Recommended Posts

I use data filtering logic to control the amount of data fetched and do not want the Grid in Paged mode, however I DO WANT the Built-In Navigation Bar - please advise how to show the Built-In Navigation Bar when not in Paged Mode - Thanks (I searched the forum but too many non related search results).

Link to comment
Share on other sites

One possible solution:

OnFormReady ->

procedure TMainForm.UniFormReady(Sender: TObject);
begin
  with UniDBGrid1, UniDBGrid1.JSInterface do
    if not WebOptions.Paged then
      JSCall('addDocked', [JSObject(['xtype', 'toolbar', 'dock', 'bottom', 'height', '40px', 'items', UniDBNavigator1.JSControl])]);

end;

 

Link to comment
Share on other sites

UniDBNavigator1 is not the Built-In one but an externally added one, I need the Built-In PaginBar that has been modified by me in FormCreate Grid.UniEvents

MyScript:= 'pagingBar.afterCreate=function pagingBar.afterCreate(sender)'#13#10 +
                   '{'#13#10 +
                   I add all of the new Buttons and DatePickers etc. here, all good, they show and work perfectly when paged

Link to comment
Share on other sites

This is what I found, there are several grids and I wanted to sync all Grid DatePicker's value no matter which grid DatePicker was clicked, I did this by using the same DatePicker ID (I know it was naughty).

Going back to unique DatePicker ID's - all good - except no date syncing.

Please show me how to set/update the value of the DatePicker in each of the Grids PagingBar at runtime - Thanks.

grdTest DatePicker id: "gridDate"

grdTest2 DatePicker id: "gridDate2"

etc.

Thinking Out Aloud ???
with grdTest2.JSInterface do begin
  with pagingBar.JSInterface do begin
    JSCall('getPicker().setValue', ['+MyDate+']);
  end;
end;

Please advise - Thanks

Link to comment
Share on other sites

I have, see txt file above, extract below

MyScript:= 'pagingBar.afterCreate=function pagingBar.afterCreate(sender)'#13#10 +
             '{'#13#10 +
             '  '#13#10 +
             '  sender.add('#13#10 +
             '  [ '#13#10 +

             '    {'#13#10 +
             '      xtype: '#39'tbseparator'#39#13#10 +
             '    },'#13#10 +

             '    {'#13#10 +
             '      xtype: "datefield", '#13#10 +
             '      fieldLabel: "", '#13#10 +
             '      formatText: "Date", '#13#10 +
             '      labelWidth: "0px", '#13#10 +
             '      format: "d/m/Y", '#13#10 +
             '      value: new Date(), '#13#10 +
             '      id: "gridDate2", '#13#10 +
             '      width: 120, '#13#10 +
             '      startDay: 1, '#13#10 +
             '      listeners: '#13#10 +
             '      {'#13#10 +
             '        change: function(el, v) '#13#10 +
             '        {'#13#10 +
             '          ajaxRequest(sender, '#39'_DateChange_'#39', ["dtIndx=0", "val=" + Ext.Date.format(v, "d/m/Y")]) '#13#10 +
             '        }'#13#10 +
             '      }'#13#10 +
             '    },'#13#10 +
...

Please advise how I can set the Grid's PagingBar DatePicker(id: "gridDate2") outside of Grid event.

Link to comment
Share on other sites

7 hours ago, andyhill said:

Please advise how I can set the Grid's PagingBar DatePicker(id: "gridDate2") outside of Grid event.

procedure TMainForm.UniButton1Click(Sender: TObject);
var
  DateFieldId: string;
begin
  DateFieldId := 'gridDate2';
  UniDBGrid1.JSInterface.JSCode('var dateValue=Ext.Date.parse("'+FormatDateTime('yyyy-mm-dd hh:nn:ss', Now) +'", "Y-m-d H:i:s");'#1'.pagingBar.getComponent("'+ DateFieldId +'").setValue(dateValue);')
end;

 

Link to comment
Share on other sites

Grid is displayed in Panel with Flex sizing that effects the Grid Size and Therefore the PageSize (including Orientation).

Constantly re-calculating the Grid Size and Re-Setting the PageSize is just not elegant - plus rows are not always flush with Grid Footer (grid size / font sizing etc.).

 

 

Link to comment
Share on other sites

Yes, WebOptions:-

Paged:= True;
PageSize:= AUTO;

Grid is auto-sizing via flex container, Screen real-estate varies, Grid.Row.Cell.Font's vary, I want the Grid fully populated with maximum number of rows.

"Constantly re-calculating the Grid Size and Re-Setting the PageSize is just not elegant - plus rows are not always flush with Grid Footer (grid size / font sizing etc.) no matter how it is calculated"

Link to comment
Share on other sites

@andyhill

I don’t understand what recalculation you are talking about.

13 hours ago, andyhill said:

PageSize:= AUTO;

You have three options at least I think.

1. After querying the database, you must find out the count of records, and set this value to WebOptions.PageSize.

2. Just set the value to the maximum, for example: 

WebOptions.PageSize := MaxInt;

3. Do not use pagingBar at all, and use your own, as I gave the example above.

It's all...

Link to comment
Share on other sites

Yes Sherzod, the "dateValue=Ext.Date.parse" code above was perfect - thank you again.

I understand that I can add my own NavigationBar but I prefer to use the auto-built-in PagingBar one that comes with the Grid Component (this reduces component count on large projects).

I understand your MaxInt suggestion.

In the future, can we get Sencha to allow the PagingBar to be shown even when the grid is not in Paged Mode (I control which buttons are shown and which buttons are hidden). Also an Auto-PageSize would be a nice addition.

Thanks again.

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