Hi,
I have a grid which has two 'debit' 'credit' columns & I want to show the sum of these columns in my summaries. The issue I am facing is this that the sum is calculated only for the rows which are part of the grid's datasource or more specifically the rows which are loaded through DataSourcUrl, I have also allowed to Add New Rows to the grid, But the rows which are added through AddNewRows are not being calculated by the summaries. From what I know is that the summaries is only calculating the sum of rows which are committed & not the ones in the igTransactions.
What should be done to calculate the sum of normal rows(already-added(commited)) as well as those rows which are added later by the user through the "AddNewRow" button after the grid data is rendered. In simpler words How to calculate sum of already added rows as well as rows which are currently in 'igTransaction'.
Thanks.
Summaries are working fine now with AutoCommit(true). I might have done something wrong earlier. Thanks.
Hello Petar,
Thanks for the response. I have intentionally opted out of the saveChanges() method of igGrid. I send the Form's data (master) along with the Grid's data (Detail/igTransactions) in one single separate Ajax Post method which I call when the user submits the form. I am not using the built-in method igGrid.saveChanges() for several reasons, one of the main reasons being not able to get both igTransactions as well as form's data in one single method. So committing the rows to the database(server) as soon as they are added in the grid is not an option in my scenario because I am not using igGrid's UpdateUrl method.
------------------------------------------------------------------------------------------
Reason for not using the UpdateUrl is defined by my colleague in this thread:
https://ko.infragistics.com/community/forums/f/ignite-ui-for-javascript/91823/form-s-post-method-instead-of-updateurl-called/453846#453846
And also in this thread:
https://ko.infragistics.com/community/forums/f/ignite-ui-for-javascript/92334/null-datetime-01-01-0001-00-00-00-in-igtransactions-gridtransaction-mymodel
-------------------------------------------------------------------------------------------
Is there any workaround of this problem? Cant I just calculate the summaries of all the rows (transactions as well as dataSource) in the grid ? Or any other way that you think would be suitable. I cannot commit the rows to the server because of various reasons so commiting them to make them a part of the dataSource is not an option for me. I'll be waiting for your response on this , thanks in advance.
Hello Zep lin,
As the grid in this case is bound to the result of an MVC method, the saveChanges method needs to be invoked in order to commit the new rows in the controller. After that, the summaries should be updated. Note that the autoCommit method commits the changes only in the datasource instantiated on the client.
https://www.igniteui.com/help/14.2/iggrid-updating
Hope this helps. Please feel free to contact me if you have any questions.
AutoCommit is set to true still summaries are not being calculated for all rows.
And I console.logged() "allTransactions" as well as "dataSource" of grid and in igTransactions I have 1 row & in dataSoruce I have 3 rows(2 rows from original datasource+1 of igTransaction) which means my dataSource now contains 3 rows but the summaries is only calculated for 2 rows. What am I doing wrong?
I have set AutoCommit(true) but still new rows are not being calculated. Also if autoCommit is set to true, Does the UpdateUrl automatically gets called immediately after a new row is added every time? If this is the case than I dont want that to happen. I want to send all the new rows in a batch with my form model & not individually everytime.
Also are the igTransaction empties everytime when a new row is added? If yes than how would I get the newly added rows in my javascripot function to send them manually to the server along with my Form's model. Also please note that I have intentionally decided to not use the saveChanges (UpdateUrl) method because of some reasons therefore I need the igTransactions as well and dont want them emptied every time a new row is added.