jahlxx Posted December 28, 2016 Posted December 28, 2016 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. Quote
Sherzod Posted December 28, 2016 Posted December 28, 2016 Hi, \FMSoft\Framework\uniGUI\Demos\Desktop\GridSummaryPaged Best regards. Quote
jahlxx Posted December 28, 2016 Author Posted December 28, 2016 OK. Thanks. And is there any way to show / hide the summary row in run-time? Thanks. Quote
Sherzod Posted December 28, 2016 Posted December 28, 2016 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', []); Quote
jahlxx Posted December 28, 2016 Author Posted December 28, 2016 sorry, Not recognized JSInterface. Quote
Sherzod Posted December 28, 2016 Posted December 28, 2016 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();'); Quote
jahlxx Posted December 29, 2016 Author Posted December 29, 2016 ok. updated to last build, I get the AJAX error: O8F9.getView(...).summaryFeature is undefined Quote
Sherzod Posted December 29, 2016 Posted December 29, 2016 ok. updated to last build, I get the AJAX error: O8F9.getView(...).summaryFeature is undefined Yes, for the first time you should set (in designtime): UniDBGrid1 -> Summary -> Enabled = True ... Can you check it? Quote
Sherzod Posted December 29, 2016 Posted December 29, 2016 Can you tell which properties you have changed on your UniDBGrid, UniDBGrid.Columns?! Or can you make small test case for this? Quote
jahlxx Posted December 29, 2016 Author Posted December 29, 2016 Only showsummary = true for 2 columns And other column showpicture = true All other columns in the grid with the default properties Quote
Sherzod Posted December 29, 2016 Posted December 29, 2016 ok. updated to last build, I get the AJAX error: O8F9.getView(...).summaryFeature is undefined When you get this error ?! Quote
jahlxx Posted December 29, 2016 Author Posted December 29, 2016 I have a button to hide summary. in the onclik event of the button I put the code: grid1.JSInterface.JSCall('getView().summaryFeature.summaryBar.hide', []); Quote
Sherzod Posted December 29, 2016 Posted December 29, 2016 Yes, it is correct Have you a "locked column"? Quote
Sherzod Posted December 29, 2016 Posted December 29, 2016 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()};'); Quote
Sherzod Posted December 29, 2016 Posted December 29, 2016 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()};' ); Quote
jahlxx Posted December 29, 2016 Author Posted December 29, 2016 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. Quote
Sherzod Posted December 29, 2016 Posted December 29, 2016 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 Quote
sertatar76 Posted July 5, 2019 Posted July 5, 2019 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 Quote
Sherzod Posted July 5, 2019 Posted July 5, 2019 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? Quote
sertatar76 Posted July 8, 2019 Posted July 8, 2019 On 7/5/2019 at 9:57 PM, Sherzod said: Thank you, I understand. It works. Quote
GoldLine Posted December 18, 2024 Posted December 18, 2024 On 12/28/2016 at 2:17 PM, Sherzod said: 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', []); Hi Sherzod, is there also a solution to show and hide grid summaryRow at RunTime für mobile TUnimDBGrid? Thx in advance Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.