Edit cell problems

Hi

Thank you for the wonderful grid control.
I have the follow problem.
I have a grid which its model contains 0 records as is supplied from server.
It has also a summary column and the grid is set to Greek locale to display Euro instead of USD.
the grid is this
<ej-grid id="gridParaggelia"
                 allow-paging="false"
                 allow-sorting=false
                 allow-filtering=false
                 allow-text-wrap=true
                 allow-scrolling=true
                 enable-alt-row=true
                 datasource=@Model
                 toolbar-click="ontbGrideidhClick"
                 query-cell-info="onQueryCellInfogridParaggelia"
                 locale="el-GR">
            <e-edit-settings allow-adding="true" allow-deleting="true" allow-edit-on-dbl-click="true" allow-editing="true" edit-mode="Normal" />
            <e-toolbar-settings show-toolbar="true" toolbar-items='@new List<string> {"edit","delete"}' />
            <e-summary-rows>
                <e-summary-row title="Σύνολο">
                    <e-summary-columns>
                        <e-summary-column summary-type="Sum" format="{0:C2}" display-column="synolo" datamember="synolo" />
                    </e-summary-columns>
                </e-summary-row>
            </e-summary-rows>
 
            <e-columns>
                <e-column field="posoths" header-text="Ποσότης" width="80" type="number" edit-type="NumericEdit"></e-column>
                <e-column field="Kvdikos" header-text="Κωδικός" width="100" allow-editing="false"></e-column>
                <e-column field="Eidos" header-text="Είδος" allow-editing="false"></e-column>
                <e-column field="Timh" header-text="Τιμή" width="80" allow-editing="false" format="{0:C2}" text-align="Right"></e-column>
                <e-column field="FPA" header-text="ΦΠΑ" width="80" allow-editing="false" text-align="Right"></e-column>
                <e-column field="synolo" header-text="Σύνολο" width="100" allow-editing="false" text-align="Right" format="{0:C2}"></e-column>
            </e-columns>
        </ej-grid>
First Problem
I add a few records using addRecord function with success. The problem is that I can change value of the  the first row only and the summary field is not updated.
When I try to edit other row the cell posoths does not change.

Second Problem
the format turns to USD and NOT Euro when I do the follow
function onQueryCellInfogridParaggelia(args)
{
    //Log("onQueryCellInfogridParaggelia::" + stringify(args));
    if (args.column.field == "synolo")
    {
        var dSynolo = args.rowData.posoths * args.rowData.Timh + (0.24 * (args.rowData.posoths * args.rowData.Timh));
        Log("onEndEditCellgridParaggelia::Synolo=" + dSynolo);
        var gridParaggelia = $("#gridParaggelia").data("ejGrid");
        var value = gridParaggelia.formatting('{0:c2}', dSynolo);
        $(args.cell).text(value);
        gridParaggelia.setCellValue(args.model.selectedRowIndex, "synolo", dSynolo);
       // gridParaggelia.refreshContent(true);
    }
}
Thank you in advance for the help
George





7 Replies

RS Renjith Singh Rajendran Syncfusion Team December 18, 2017 10:45 AM UTC

Hi George, 

Thanks for contacting Syncfusion support. 

First Problem: 
 
We have analyzed the code example. We could see that you have not set the is-primary-key property. We suggest you to set the is-primary-key property to a column. We have already discussed this topic in a KB, please refer the KB link below, 

We could also see that you have set allow-editing for all the columns in the Grid as false. So it will not be possible to edit any column in the Grid. 

Second Problem: 

We have analyzed the code example. We suggest you to pass the locale parameter also in the formatting method. Please refer the code example below, 

function onQueryCellInfogridParaggelia(args) { 
       if (args.column.field == "freight") { 
            ... 
           var value = gridParaggelia.formatting('{0:c2}', dSynolo, 'el-GR'); 
            ... 
       } 
    } 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 



GR George Rossopoulos December 18, 2017 11:27 AM UTC

Hi Renjith

Thank you for the prompt reply. As always great support.
Yes indeed was the primary key problem.

Now I have a last one. How can I update the summary column?
The grid displays the customer order.
The  first column  is the item quantity, the second is Item code, the third is item description the forth item price the fifth item VAT and the last is the line total.
When the quantity changes I update the line total value from javascript. How can I update the Summary column ?
Is there any way (function) to update the grid each time the user edits/changes the quantity of an item ?

Thank you in advance for the help
George




RS Renjith Singh Rajendran Syncfusion Team December 19, 2017 12:33 PM UTC

Hi George, 

We have analyzed your query. We have prepared a sample based on your requirement, which could be downloaded from the link below, 

We suggest you to use the custom summary of Grid. Please refer the documentation link below, 

Please refer the code example below, 
<ej-grid id="TagsGrid" allow-paging="false" allow-sorting=false locale='el-GR'> 
            ... 
            <e-summary-rows> 
                <e-summary-row title="Σύνολο"> 
                    <e-summary-columns> 
                        <e-summary-column summary-type="Custom" custom-summary-value="Total" display-column="shipCity" datamember="shipCity" /> 
                    </e-summary-columns> 
                </e-summary-row> 
            </e-summary-rows> 
            ... 
        </ej-grid> 
     
 
<script type="text/javascript"> 
    function onQueryCellInfogridParaggelia(args) { 
        if (args.column.field == "shipCity") {  
            var total = args.rowData.orderID + args.rowData.employeeID; 
            $(args.cell).text(total); 
        } 
    } 
    function Total() { 
        var gridObj = $("#TagsGrid").ejGrid("instance"); 
        var rs = ej.sum(gridObj.model.dataSource.dataSource.json, "orderID"); 
        var sr = ej.sum(gridObj.model.dataSource.dataSource.json, "employeeID"); 
        return rs + sr; 
    } 
</script> 

Regards, 
Renjith Singh Rajendran. 



GR George Rossopoulos December 20, 2017 07:05 AM UTC

Hi Renjith

Thank you for the support.
Solved the update problem with the is-primary-key.

Unfortunately still custom summary column has problem.
When I change a column value the custom summary function does NOT called to recalculate the total.
How can I set the text of custom summary column?

thank you
George


RS Renjith Singh Rajendran Syncfusion Team December 21, 2017 11:20 AM UTC

Hi George, 

We have analyzed your query and we are not able to reproduce the reported issue. We have prepared a video based on the proper working of your requirement with the sample which we have provided in our last update. Please download it from the link below, 

If you are still facing the issue, please share the exact scenario when you are facing the issue. 

  1. Share the video demonstration of the issue.
  2. Share full Grid code example. If you have done any changes in the sample we have provided, please share the changes.
  3. Share the stack trace of the issue if any script error occur in console window.
  4. If possible share the issue reproducing sample or reproduce the issue in the sample provided from the previous response.

The provided information will help us to analyze the issue and provide you the response as early as possible. 

Regards, 
Renjith Singh Rajendran. 



GR George Rossopoulos December 21, 2017 12:58 PM UTC

Hi 

Please check the video i am changing the quantity from 1 to 10 the total changes but the custom summary column not.
the grid is this

<ej-grid id="gridParaggelia"
          allow-paging="false"
          allow-sorting=false
          allow-filtering=false
          allow-text-wrap=true
          allow-scrolling=true
          enable-alt-row=true
          datasource=@Model.ListParraggelia
          toolbar-click="ontbGrideidhClick"
          query-cell-info="onQueryCellInfogridParaggelia"
          locale="el-GR">
     <e-edit-settings allow-adding="true" allow-deleting="true" allow-edit-on-dbl-click="true" allow-editing="true" edit-mode="Normal" />
     <e-toolbar-settings show-toolbar="true" toolbar-items='@new List<string> {"add","edit","delete"}' />
     <e-summary-rows>
         <e-summary-row title="Σύνολο">
             <e-summary-columns>
                 <e-summary-column  summary-type="Custom" custom-summary-value="Total" format="{0:C2}" display-column="synolo" datamember="synolo" />
             </e-summary-columns>
         </e-summary-row>
     </e-summary-rows>
 
     <e-columns>
         <e-column field="posoths" header-text="Ποσότης" width="80" type="number" edit-type="NumericEdit"></e-column>
         <e-column field="Kvdikos" header-text="Κωδικός" is-primary-key="true" width="100" allow-editing="false"></e-column>
         <e-column field="Eidos" header-text="Είδος" allow-editing="false"></e-column>
         <e-column field="Timh" header-text="Τιμή" width="80" allow-editing="false" format="{0:C2}" text-align="Right"></e-column>
         <e-column field="FPA" header-text="ΦΠΑ" width="80" allow-editing="false" text-align="Right"></e-column>
         <e-column field="synolo" header-text="Σύνολο" width="100" allow-editing="false" text-align="Right" format="{0:C2}"></e-column>
     </e-columns>
 </ej-grid>
the Javascript is
function onQueryCellInfogridParaggelia(args)
{
    
  
    if (args.column.field === "synolo")
    {
        Log("calc synolo");
        var dSynolo = args.rowData.posoths * args.rowData.Timh + (0.24 * (args.rowData.posoths * args.rowData.Timh));
        Log("onQueryCellInfogridParaggelia::Synolo=" + dSynolo);
        var gridParaggelia = $("#gridParaggelia").data("ejGrid");
        var value = gridParaggelia.formatting('{0:c2}', dSynolo, 'el-GR');
        $(args.cell).text(value);
        Log("ROW=" + args.model.selectedRowIndex);
        //gridParaggelia.setCellValue(args.model.selectedRowIndex, "synolo", dSynolo);
        //gridParaggelia.batchSave();

 
    }
}
 
function Total()
{
    try
    {
        var gridObj = $("#gridParaggelia").ejGrid("instance");     
        var rs = ej.sum(gridObj.model.dataSource, "synolo");
        return rs;
    }
    catch (err)
    {
        Log("Total() Exception=" + err);
    }
}

thank you
George

Attachment: Video_20171221_142118_409061f6.zip


RS Renjith Singh Rajendran Syncfusion Team December 22, 2017 08:59 AM UTC

Hi George, 

We have analyzed your code example. We are able to reproduce the reported issue when we apply your code example in our sample. We suggest you to update the value for the corresponding column with the value calculated for the particular cell, once updating the text of the particular cell. Please refer the code example below, 

function onQueryCellInfogridParaggelia(args) { 
 
        if (args.column.field == "freight") { 
            var dSynolo = args.rowData.orderID * args.rowData.employeeID + (0.24 * (args.rowData.orderID * args.rowData.employeeID)); 
            var gridParaggelia = $("#TagsGrid").data("ejGrid"); 
            var value = gridParaggelia.formatting('{0:c2}', dSynolo, 'el-GR'); 
            $(args.cell).text(value); 
            args.data.freight = dSynolo; 
       } 
} 

In our previous update we have returned the added values of two columns in the custom summary method “Total”, so it worked in our sample. But as per your requirement, you are returning the sum of the particular column, then it is needed to update the dataSource with the calculated value as like the code example above.  

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 


Loader.
Up arrow icon