The Value status of the data that needs to be rounded is changed because of the "ej2" file.

Hello Syncfusion Team.

I'd appreciate it if you could tell me the reason for the problem after watching the video that I'm providing

As you can see from the video, the Grid in the "Error" video changes the raised value through the "ej2" file, and the "No Error" video is updated with the raised value accurately.

Please refer to the code provided below

//Error grid

<ejs-grid id="DataInputGrid" created="GridCreated" allowSelection="true" gridLines="Both" rowHeight="30" frozenColumns="7" height="530px" toolbarClick="MainToolbarClick" queryCellInfo="queryCellInfo"
              allowResizing="true" allowTextWrap="true" cellSave="cellSave" dataBound="dataBound" cellEdit="cellEdit" rowSelecting="rowSelecting" rowDeselected="rowDeselected" beforeBatchAdd="beforeBatchAdd" rowDataBound="rowDataBound"
              toolbar="@(new List<string>() {"Add","Delete","Update","Cancel" })">
        @*<e-grid-aggregates>
                <e-grid-aggregate>
                    <e-aggregate-columns>
                        <e-aggregate-column field="RM_AREA" type="Custom" footerTemplate="AIR SYSTEM :${Custom}" customAggregate="@("customAggregateFn")"></e-aggregate-column>
                    </e-aggregate-columns>
                </e-grid-aggregate>
            </e-grid-aggregates>
            <e-grid-aggregates>
                <e-grid-aggregate>
                    <e-aggregate-columns>
                        <e-aggregate-column field="RM_AREA" type="Sum" footerTemplate="ALL :${Sum}"></e-aggregate-column>
                    </e-aggregate-columns>
                </e-grid-aggregate>
            </e-grid-aggregates>*@
        <e-grid-textwrapsettings wrapMode="Header"></e-grid-textwrapsettings>
        <e-grid-selectionsettings checkboxOnly="true" type="Single"></e-grid-selectionsettings>
        <e-grid-editSettings allowAdding="true" allowEditing="true" allowDeleting="true" mode="Batch" newRowPosition="Bottom"></e-grid-editSettings>
        <e-grid-columns>
            <e-grid-column id="checkBox" type="checkBox" width="40" headerTextAlign="Center" textAlign="Center"></e-grid-column>
            <e-grid-column field="BLDG_SNO" visible="false" isPrimaryKey="true" defaultValue="@empty"></e-grid-column>


            @*Frozen Column*@
            <e-grid-column headerText="BUILDING INFORMATION" headerTextAlign="Center" textAlign="Center"
                           columns="@(new List<Syncfusion.EJ2.Grids.GridColumn>() {
                new Syncfusion.EJ2.Grids.GridColumn { HeaderText ="ROOM INFORMATION", HeaderTextAlign = Syncfusion.EJ2.Grids.TextAlign.Center, TextAlign = Syncfusion.EJ2.Grids.TextAlign.Center, Columns = new List<Syncfusion.EJ2.Grids.GridColumn>(){
                    new Syncfusion.EJ2.Grids.GridColumn { Field ="RM_SNO" , Width ="150", HeaderText ="KEY" , DefaultValue ="" , HeaderTextAlign = Syncfusion.EJ2.Grids.TextAlign.Center, TextAlign = Syncfusion.EJ2.Grids.TextAlign.Left},
                    new Syncfusion.EJ2.Grids.GridColumn { Field ="ROOM_NO" , Width ="90" , HeaderText ="ROOM NO." , DefaultValue ="" , HeaderTextAlign = Syncfusion.EJ2.Grids.TextAlign.Center, TextAlign = Syncfusion.EJ2.Grids.TextAlign.Left , ValidationRules = new { required = true}},
                    new Syncfusion.EJ2.Grids.GridColumn { Field ="AIR_SYS_NM" , Width ="90" , HeaderText ="AIR SYSTEM NAME", DefaultValue ="" , HeaderTextAlign = Syncfusion.EJ2.Grids.TextAlign.Center, TextAlign = Syncfusion.EJ2.Grids.TextAlign.Left , ValidationRules = new { required = true, number=true }},
                    new Syncfusion.EJ2.Grids.GridColumn { Field ="ID_COND_ZONE", Width ="60" , HeaderText ="ZONE" , DefaultValue ="" , HeaderTextAlign = Syncfusion.EJ2.Grids.TextAlign.Center, TextAlign = Syncfusion.EJ2.Grids.TextAlign.Right , ValidationRules = new { required = true, number=true}},
                    new Syncfusion.EJ2.Grids.GridColumn { Field ="RM_NM" , Width ="200", HeaderText ="ROOM NAME" , DefaultValue ="" , HeaderTextAlign = Syncfusion.EJ2.Grids.TextAlign.Center, TextAlign = Syncfusion.EJ2.Grids.TextAlign.Left , ValidationRules = new { required=true}}}
                }})">
            </e-grid-column>
</e-grid-columns>
    </ejs-grid>

function cellSave(args) {


        //작업 Row
        var rowData = args.rowData;
        //작업 Row Index
        var rowIndex = this.getRowInfo(args.cell.closest('tr')).rowIndex;
        //작업 Cell Value
        var cellValue = args.value == null ? args.value : parseFloat(args.value);
        if (isNaN(cellValue)) cellValue = args.value;


        var RM_AREA;
switch (args.columnName) {
case "RM_AREA":
                testGrid = document.getElementById('DataInputGrid').ej2_instances[0];
                //testGrid.columns[7].validationRules = { required: true, minLength: [customFn, 'Need atleast 5 letters'] };
                RM_AREA = Math.ceil(args.value * 10) / 10;
                testGrid.updateCell(rowIndex, "RM_AREA", RM_AREA);


                if (args.previousValue != args.value) {


                    let RM_CLG_HGT = (rowData.RM_CLG_HGT == null || rowData.RM_CLG_HGT == "") ? 0 : rowData.RM_CLG_HGT;
                    let HD_ELTR_WT = (rowData.HD_ELTR_WT == null || rowData.HD_ELTR_WT == "") ? 0 : rowData.HD_ELTR_WT;
                    let HD_ISTRM_WT = (rowData.HD_ISTRM_WT == null || rowData.HD_ISTRM_WT == "") ? 0 : rowData.HD_ISTRM_WT;
                    let HD_TC_WT = (rowData.HD_TC_WT == null || rowData.HD_TC_WT == "") ? 0 : rowData.HD_TC_WT;
                    let HD_ETC_WT = (rowData.HD_ETC_WT == null || rowData.HD_ETC_WT == "") ? 0 : rowData.HD_ETC_WT;
                    let HD_TOTAL_WT = (rowData.HD_TOTAL_WT == null || rowData.HD_TOTAL_WT == "") ? 0 : rowData.HD_TOTAL_WT;
                    let FAS_AB_UTFL = (rowData.FAS_AB_UTFL == null || rowData.FAS_AB_UTFL == "") ? 0 : rowData.FAS_AB_UTFL;
                    let FAS_ACH = (rowData.FAS_ACH == null || rowData.FAS_ACH == "") ? 0 : rowData.FAS_ACH;
                    /* let FAS_FA_FLRT = (rowData.FAS_FA_FLRT == null || rowData.FAS_FA_FLRT == "") ? 0 : rowData.FAS_FA_FLRT;*/


                    let RM_VOL;
                    if (RM_CLG_HGT != 0) {
                        //ROOM VOLUME(10) - 소수점 한자리
                        RM_VOL = Math.floor(cellValue * RM_CLG_HGT * 10) / 10;
                        this.updateCell(rowIndex, "RM_VOL", RM_VOL);


                        //ACH 값이 있는 경우
                        if (FAS_ACH != 0) {
                            //FLOW RATE(59)
                            let FAS_ACH_FLRT = Math.floor((FAS_ACH * RM_VOL) / 3.6 * 10) / 10;
                            this.updateCell(rowIndex, "FAS_ACH_FLRT", FAS_ACH_FLRT);


                            //SELECTED F.A (62) -Max 값 Update
                            rowData.FAS_ACH_FLRT = FAS_ACH_FLRT;
                            FAS_FA_SELEC_FLRT = arrayMax(rowData);
                            this.updateCell(rowIndex, "FAS_FA_SELEC_FLRT", FAS_FA_SELEC_FLRT);
                        }
                    }


                    if (HD_ELTR_WT != 0) {
                        //ELEC-HEAT DISSPATION / AREA(30) - 소수점 한자리
                        let HD_ELTR_WT_AREA = Math.floor(HD_ELTR_WT / cellValue * 10) / 10;
                        this.updateCell(rowIndex, "HD_ELTR_WT_AREA", HD_ELTR_WT_AREA);
                    }


                    if (HD_ISTRM_WT != 0) {
                        //INST-HEAT DISSPATION / AREA(32) - 소수점 한자리
                        let HD_ISTRM_WT_AREA = Math.floor(HD_ISTRM_WT / cellValue * 10) / 10;
                        this.updateCell(rowIndex, "HD_ISTRM_WT_AREA", HD_ISTRM_WT_AREA);
                    }


                    if (HD_TC_WT != 0) {
                        //TELE-HEAT DISSPATION / AREA(34) - 소수점 한자리
                        let HD_TC_WT_AREA = Math.floor(HD_TC_WT / cellValue * 10) / 10;
                        this.updateCell(rowIndex, "HD_TC_WT_AREA", HD_TC_WT_AREA);
                    }


                    if (HD_ETC_WT != 0) {
                        //ETC-HEAT DISSPATION / AREA(36) - 소수점 한자리
                        let HD_ETC_WT_AREA = Math.floor(HD_ETC_WT / cellValue * 10) / 10;
                        this.updateCell(rowIndex, "HD_ETC_WT_AREA", HD_ETC_WT_AREA);
                    }


                    if (HD_TOTAL_WT != 0) {
                        //TOTAL-HEAT DISSPATION / AREA(38) - 소수점 한자리
                        let HD_TOTAL_WT_AREA = Math.floor(HD_TOTAL_WT / cellValue * 10) / 10;
                        this.updateCell(rowIndex, "HD_TOTAL_WT_AREA", HD_TOTAL_WT_AREA);
                    }


                    if (FAS_AB_UTFL != 0) {
                        //FLOW RATE(44) - 소수점 한자리
                        let FAS_AB_FLRT = Math.floor(FAS_AB_UTFL * cellValue * 10) / 10;
                        this.updateCell(rowIndex, "FAS_AB_FLRT", FAS_AB_FLRT);


                        rowData.FAS_AB_FLRT = FAS_AB_FLRT;
                    }


                    //dP(54) / TIGHTNESS(55) 값이 있는 경우 Pressure 상세계산서 쪽 Data Update
                    let FAS_DPB_DP = (rowData.FAS_DPB_DP == null || rowData.FAS_DPB_DP == "") ? 0 : rowData.FAS_DPB_DP;
                    let FAS_DPB_TIGHT = (rowData.FAS_DPB_TIGHT == null || rowData.FAS_DPB_TIGHT == "") ? 0 : rowData.FAS_DPB_TIGHT;


                    //Pressure Calculation 값 가져오기
                    OWA_N = (rowData.OWA_N == null || rowData.OWA_N == "") ? 0 : parseFloat(rowData.OWA_N);
                    OWA_E = (rowData.OWA_E == null || rowData.OWA_E == "") ? 0 : parseFloat(rowData.OWA_E);
                    OWA_S = (rowData.OWA_S == null || rowData.OWA_S == "") ? 0 : parseFloat(rowData.OWA_S);
                    OWA_W = (rowData.OWA_W == null || rowData.OWA_W == "") ? 0 : parseFloat(rowData.OWA_W);
                    RM_AREA = Math.ceil(args.value * 10) / 10; // ROOF AREA(9)


                    var grid = this;
                    FAS_DPB_FLRT = PressureCalculation(grid, rowIndex, OWA_N, OWA_E, OWA_S, OWA_W, RM_AREA, FAS_DPB_DP, FAS_DPB_TIGHT);


                    //FLOW RATE(56)
                    this.updateCell(rowIndex, "FAS_DPB_FLRT", FAS_DPB_FLRT);


                    rowData.FAS_DPB_FLRT = FAS_DPB_FLRT;


                    //SELECTED F.A (62) -Max 값 Update
                    FAS_FA_SELEC_FLRT = arrayMax(rowData);
                    this.updateCell(rowIndex, "FAS_FA_SELEC_FLRT", FAS_FA_SELEC_FLRT);


                }
                break;
                }

}

//No Error Grid

<head>
    <title> AIR SYSTEM SUMMARY </title>
    <link rel="stylesheet" rel='nofollow' href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
    <link rel="stylesheet" rel='nofollow' href="~/css/site.css" />
    <link rel="stylesheet" rel='nofollow' href="https://cdn.syncfusion.com/ej2/bootstrap5.css" />
    <script src="https://cdn.syncfusion.com/ej2/dist/ej2.min.js"></script>
    <!-- Automatically provides/replaces `Promise` if missing or broken. -->
    <script src="~/js/promise.js"></script>
    <script src="~/js/promise.auto.js"></script>
    <!-- Minified version of `es6-promise-auto` below. -->
    <script src="~/js/promise.min.js"></script>
    <script src="~/js/promise.auto.min.js"></script>
</head>
<body style="width: 100%; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; margin-bottom: 0px;">


    <input id="BldgNo" class="e-hidden" value="@ViewBag.BldgNo" />


    <div class="row" style="vertical-align:middle;">
        <div class="col-12">
            <hr style="border:solid 1px;" />
            <h4 style="margin-left: 30px; ">AIR SYSTEM SUMMARY</h4>
            <hr style="border:solid 1px;" />
        </div>
    </div>


    <div class="row">
        <div class="col-12">
            <ejs-grid id="AirSystemGrid" toolbar="toolbarItems" gridLines="Both" rowHeight="30" queryCellInfo="queryCellInfo" created="Created" cellSave="cellSave" allowTextWrap="true" cellEdit="cellEdit" >
<e-grid-textwrapsettings wrapMode="Header"></e-grid-textwrapsettings>
                <e-grid-editSettings allowAdding="true" allowEditing="true" allowDeleting="true" mode="Batch" newRowPosition="Bottom"></e-grid-editSettings>
                <e-grid-columns>
                    <e-grid-column field="AIR_SYS_NM" headerText="AIR SYSTEM NAME" defaultValue="@empty" headerTextAlign="Center" textAlign="Left" ></e-grid-column>
                    <e-grid-column field="COOL_COIL" headerText="COOLING COIL LOAD (kW)" format="N1" defaultValue="@empty" headerTextAlign="Center" textAlign="Right" width="80" validationRules="@(new { number=true })"></e-grid-column>
                    <e-grid-column field="HEAT_COIL" headerText="HEATING COIL LOAD (kW)" format="N1" defaultValue="@empty" headerTextAlign="Center" textAlign="Right" width="80" validationRules="@(new { number=true })"></e-grid-column>
                    <e-grid-column field="SPL_AIR_FLRT" headerText="SUPPLY AIR FLOW RATE (L/S)" format="N1" defaultValue="@empty" headerTextAlign="Center" textAlign="Right" width="80" validationRules="@(new { number=true })"></e-grid-column>
                    <e-grid-column field="FRS_AIR_FLRT" headerText="FRESH AIR FLOW RATE (L/S)" format="N1" defaultValue="@empty" headerTextAlign="Center" textAlign="Right" width="80" validationRules="@(new { number=true })"></e-grid-column>
                    <e-grid-column field="ENT_DB" headerText="ENTERING DB(°C)" format="N1" defaultValue="@empty" headerTextAlign="Center" textAlign="Right" width="80" validationRules="@(new { number=true })"></e-grid-column>
                    <e-grid-column field="ENT_WB" headerText="ENTERING WB(°C)" format="N1" defaultValue="@empty" headerTextAlign="Center" textAlign="Right" width="80" validationRules="@(new { number=true })"></e-grid-column>
                    <e-grid-column field="LV_DB" headerText="LEAVING DB(°C)" format="N1" defaultValue="@empty" headerTextAlign="Center" textAlign="Right" width="80" validationRules="@(new { number=true })"></e-grid-column>
                    <e-grid-column field="LV_WB" headerText="LEAVING WB(°C)" format="N1" defaultValue="@empty" headerTextAlign="Center" textAlign="Right" width="80" validationRules="@(new { number=true })"></e-grid-column>
                    <e-grid-column field="SSB_COIL_LOAD" headerText="SENSIBLE COIL LOAD (kW)" format="N1" defaultValue="@empty" headerTextAlign="Center" textAlign="Right" width="80" validationRules="@(new { number=true })"></e-grid-column>
                    <e-grid-column field="CHID_WT_FLRT" headerText="CHILLED WATER FLOW RATE (L/M)" format="N1" defaultValue="@empty" headerTextAlign="Center" textAlign="Right" width="80" validationRules="@(new { number=true })"></e-grid-column>
                    <e-grid-column field="FLOR_AREA" headerText="FLOR AREA (m2)" format="N1" defaultValue="@empty" headerTextAlign="Center" textAlign="Right" width="80" validationRules="@(new { number=true })"></e-grid-column>
                    <e-grid-column field="FMB" headerText="FAN MOTOR BHP" format="N1" defaultValue="@empty" headerTextAlign="Center" textAlign="Right" width="80" validationRules="@(new { number=true })"></e-grid-column>
                    <e-grid-column field="FMK" headerText="FAN MOTOR KW" format="N1" defaultValue="@empty" headerTextAlign="Center" textAlign="Right" width="80" validationRules="@(new { number=true })"></e-grid-column>
                </e-grid-columns>
            </ejs-grid>
      </div>
    </div>



function cellSave(args) {
            if (args.columnName != "AIR_SYS_NM") {
                args.value = Math.ceil((args.value) * 10) / 10;
            }
        }



8 Replies

TK TaeWook Kang September 6, 2022 06:08 AM UTC

The email address where the video was sent

: [email protected]


Incoming Email

: [email protected]


thank you





RS Rajapandiyan Settu Syncfusion Team September 7, 2022 07:04 PM UTC

Hi TaeWook,


Thanks for contacting Syncfusion support.


There is no video attached in your updates. So, kindly share the video demo of the reported problem which will be very helpful to validate the issue further.


Regards,

Rajapandiyan S



TK TaeWook Kang September 7, 2022 11:10 PM UTC

I am sending it again after receiving a reply that I did not receive the attached file.

Please check as soon as possible.


The email address where the video was sent

: [email protected]


regards.



SG Suganya Gopinath Syncfusion Team September 8, 2022 05:00 AM UTC

Hi TaeWook Kang,

We have received your ticket, please follow the ticket for further updates. 

Regards,

Suganya Gopinath. 



TK TaeWook Kang September 12, 2022 11:29 PM UTC

I checked the ticket you provided, and there is no ticket for this inquiry in the 'View ticket' menu.

Please check as soon as possible.

I sent you the attached video by e-mail, but please reply if you can't check it as well.



RS Rajapandiyan Settu Syncfusion Team September 13, 2022 11:58 AM UTC

Hi TaeWook,


Sorry for the inconvenience caused. Please find the response of your query below (we have already updated in the ticket).

By analyzing your code example, we found that when you edit the “RM_AREA” cell, you are executing updateCell method on the same cell in the cellSave event. We are not supposed to execute the updateCell method on the same field in the cellSave event. This is the behavior of Grid.


If you want to change the value, you can use args.value in the event.



    function cellSave(args) {

        switch (args.columnName) {

            case "RM_AREA":

                testGrid = document.getElementById('DataInputGrid').ej2_instances[0];

                RM_AREA = Math.ceil(args.value * 10) / 10;

                args.value = RM_AREA;

        }

    }


Or, if you need use updateCell method on the same column, you need to execute args.cancel in that event.



    function cellSave(args) {

        switch (args.columnName) {

            case "RM_AREA":

                testGrid = document.getElementById('DataInputGrid').ej2_instances[0];

                RM_AREA = 98;

                args.cancel = true;

                testGrid.updateCell(rowIndex, "RM_AREA", RM_AREA);

        }

    }

 


Please get back to us if you need further assistance.

Note: Still, if you have any concerns, please contact the Syncfusion team through the previous ticket.

Regards,

Rajapandiyan S



TK TaeWook Kang September 14, 2022 05:26 AM UTC

Thank you for your reply.

However, I have applied the information, but I would appreciate it if you could reply again after confirming that the following error occurs.


case "RM_AREA":

                testGrid = document.getElementById('DataInputGrid').ej2_instances[0];
                //testGrid.columns[7].validationRules = { required: true, minLength: [customFn, 'Need atleast 5 letters'] };
                RM_AREA = Math.ceil(args.value * 10) / 10;
                args.cancel = true;
                testGrid.updateCell(rowIndex, "RM_AREA", RM_AREA);


RS Rajapandiyan Settu Syncfusion Team September 15, 2022 02:11 PM UTC

Hi TaeWook,


Thanks for your update.


Kindly execute the updateCell method after some time interval.



    function cellSave(args) {

        switch (args.columnName) {

            case "RM_AREA":

                testGrid = document.getElementById('DataInputGrid').ej2_instances[0];

                RM_AREA = 98;

                args.cancel = true;

                setTimeout(() => {

                     testGrid.updateCell(rowIndex, "RM_AREA", RM_AREA);

                }, 300)

        }

    }

 


Still, if you face the issue, kindly change the value through args.value.



    function cellSave(args) {

        switch (args.columnName) {

            case "RM_AREA":

                testGrid = document.getElementById('DataInputGrid').ej2_instances[0];

                RM_AREA = Math.ceil(args.value * 10) / 10;

                args.value = RM_AREA;

        }

    }


Please get back to us if you need further assistance.

Regards,

Rajapandiyan S


Loader.
Up arrow icon