How can we set two edit option for paritcular cell to achieve onchange event and to display cell in decimal format

Hi , Syncfusion Team

Help me to solve this,

How to use two edit option for same cell in inline data grid , Because decimal format (format="N3") is not applying to the (Gross Weight) Cell while using this event [edit="@((new {create = "create", read = "read", destroy = "destroy",write = "write"}))"]

Example: format="N3" textAlign="Left" edittype="NumericEdit" validationRules="@(new { required=true,number=true,maxLength= 4})"edit="@((new {create = "create", read = "read", destroy = "destroy",write = "write"}))" edit="@(new { @params = new Syncfusion.EJ2.Inputs.NumericTextBox() {ShowSpinButton=false, Decimals = 3,Format = "N3"}})" width="90">

Forum_SS.png

Thanks,


3 Replies

RS Rajapandiyan Settu Syncfusion Team June 24, 2022 02:54 PM UTC

Hi Kalpatharu, 


Thanks for contacting Syncfusion support.


In EJ2 Grid column, we are not supposed to use both editParams and cellEditTemplate in the same column. We have to use any of these in a column.


If you want to apply format on cellEditTemplate feature, you can achieve this by following the below way.


 

        <e-grid-column field="Weight" headerText="Weight" format="N3" editType="numericedit" edit="@(new {create = "create", read = "read", destroy = "destroy", write = "write"})"  width="120"></e-grid-column>

 

 

<script>

    var NTObj;

 

    function create(args) {

        elem = document.createElement('input');

        return elem;

    }

 

    function write(args) {
        // customize your Numeric textbox component

        NTObj = new ej.inputs.NumericTextBox({

            // sets value to the NumericTextBox

            value: args.rowData[args.column.field],

            format: "N3",

            showSpinButton: false,

            decimals: 3,

        });

        NTObj.appendTo(args.element);

    }

 

    function destroy() {

        NTObj.destroy();

    }

 

    function read(args) {

        return NTObj.value;

    }

</script>

 


If you want to apply format through editParams, you can achieve it by using the following code,



        <e-grid-column field="Freight" headerText="Freight" format="N3" editType="numericedit" edit="@(new { @params = new Syncfusion.EJ2.Inputs.NumericTextBox() {ShowSpinButton=false, Decimals = 3,Format = "N3"}})"  width="120"></e-grid-column>

 


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/core_grid_numericedit7710349.zip


If this does not meet your requirement, kindly explain more details to proceed further.


Regards, 

Rajapandiyan S



KA KALPATHARU replied to Rajapandiyan Settu June 30, 2022 06:17 AM UTC

Hi MR. Rajapandiyan 


Thanks for your Support, is working fine now.


Regards,
Kalpatharu



RS Rajapandiyan Settu Syncfusion Team July 1, 2022 12:36 PM UTC

Hi Kalpatharu, 


We are glad to hear that you have achieved your requirement with the solution provided.


Please get back to us if you need further assistance.


Regards, 

Rajapandiyan S


Loader.
Up arrow icon