Jump to content

grid summary


jahlxx

Recommended Posts

Hi.

 

I put the summary row as the first line of a grid.

 

My summary is for "qty" column, but only when a boolan column of the grid is checked, as the code below in the ColumnSummary procedure:

 

  if SameText(Column.FieldName, 'qty') then begin
    if Column.AuxValue=NULL then Column.AuxValue:=0.0;
    if qt.FieldByName('sel').asboolean then
       Column.AuxValue:=Column.AuxValue + qt.FieldByName('qty').asfloat;
  end;
 

 

As I can see, the summary calculation is wrong when the grid is paged. The summary only is calculated for the actual page of the grid.

 

Is there somethig I have forgotten?

 

Thanks.

Link to comment
Share on other sites

And is there any way to show / hide the summary row in run-time?

 

For now can you try this?!:

 

1. UniDBGrid1 -> Summary -> Enabled = True ...

 

2. Show/Hide... :

UniDBGrid1.JSInterface.JSCall('getView().summaryFeature.summaryBar.show', []);
UniDBGrid1.JSInterface.JSCall('getView().summaryFeature.summaryBar.hide', []);
Link to comment
Share on other sites

sorry, Not recognized JSInterface.

 

Build 1347:

 

[uNG-1933] - TUniControl: New JSInterface public property.

 

For your current build you can use like this:

UniSession.AddJS(UniDBGrid1.JSName + '.getView().summaryFeature.summaryBar.show();');
UniSession.AddJS(UniDBGrid1.JSName + '.getView().summaryFeature.summaryBar.hide();');
Link to comment
Share on other sites

Ok, Then try this:

UniDBGrid1.JSInterface.JSCode('var me='#1'; var _view=me.normalGrid.getView() || me.getView(); if (_view) {_view.summaryFeature.summaryBar.show()};');
UniDBGrid1.JSInterface.JSCode('var me='#1'; var _view=me.normalGrid.getView() || me.getView(); if (_view) {_view.summaryFeature.summaryBar.hide()};');
Link to comment
Share on other sites

Corrected:

 

Hide:

  UniDBGrid1.JSInterface.JSCode('var me='#1'; var _view=null; var _lockedview=null; if (!me.lockedGrid && !me.normalGrid) {_view=me.getView()} else {_view=me.normalGrid.getView(); _lockedview=me.lockedGrid.getView()}; '+
                                'if (_view) {_view.summaryFeature.summaryBar.hide()};'+
                                'if (_lockedview) {_lockedview.summaryFeature.summaryBar.hide()};'
  );

Show:

  UniDBGrid1.JSInterface.JSCode('var me='#1'; var _view=null; var _lockedview=null; if (!me.lockedGrid && !me.normalGrid) {_view=me.getView()} else {_view=me.normalGrid.getView(); _lockedview=me.lockedGrid.getView()}; '+
                                'if (_view) {_view.summaryFeature.summaryBar.show()};'+
                                'if (_lockedview) {_lockedview.summaryFeature.summaryBar.show()};'
  );
Link to comment
Share on other sites

One question, I think not related with unigui. Sorry for this.

 

I've never used clientdataset, and in the samble on summary grid, I see thjat it's used.

 

Sometimes I need temporary tables, and I create them in my database, but I think clientdataset could be usefull for me, but I don't know how it works. It works with data in memory?

 

I copy / paste the clientdataset and datasource of the sample on a form of my project, but can't acivate the dataset. When open or set it to active, raises the error:

missing data provider or data packet.

 

Thanks.

Link to comment
Share on other sites

Hi,

 

At runtime you can use ClientDataSet.CreateDataset or if this is on a design surface you can right click on the CDS and click create dataset. You need to have specified columns/types for the CDS before you can do this though.

 

http://stackoverflow.com/questions/274958/delphi-using-tclientdataset-as-an-in-memory-dataset

http://www.scalabium.com/faq/dct0150.htm

Link to comment
Share on other sites

  • 2 years later...

I did it, but got a error 

  if not UniDBGrid1.Summary.Enabled then
  begin
    UniDBGrid1.Summary.Enabled := True;
//    UniDBGrid1.OnColumnSummary := UniDBGrid1ColumnSummary;
//    UniDBGrid1.OnColumnSummaryResult := UniDBGrid1ColumnSummaryResult;
    UniDBGrid1.JSInterface.JSCode('var me='#1'; var _view=null; var _lockedview=null; if (!me.lockedGrid && !me.normalGrid) {_view=me.getView()} else {_view=me.normalGrid.getView(); _lockedview=me.lockedGrid.getView()}; '+
                                'if (_view) {_view.summaryFeature.summaryBar.show()};'+
                                'if (_lockedview) {_lockedview.summaryFeature.summaryBar.show()};'
    );

  end;

Cannot read property 'summaryBar' of undefined
 
Link to comment
Share on other sites

4 hours ago, sertatar76 said:

I did it, but got a error 

 

On 12/29/2016 at 4:04 PM, Sherzod said:

Yes, for the first time you should set (in designtime):


UniDBGrid1 -> Summary -> Enabled = True ...

Can you check it?

 

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