We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How I can change the value from a ej-percentage-text-box to a column

Hi, my friends, I wondering how can I change the column value from a  ej-percentage-text-box when I click on "Aplicar tasa" for example:


when I get click all 61% change to 20%

3 Replies

VN Vignesh Natarajan Syncfusion Team March 1, 2019 07:00 AM UTC

Hi Neider, 
 
Thanks for contacting Syncfusion support. 
 
Query: “ how can I change the column value from a  ej-percentage-text-box when I click on "Aplicar tasa"” 
 
From your query we understand that you need to update the percentage column based on the ejPercentageTextBox. We have achieved your requirement using the setCellText method of Grid.  
 
Please refer the below help documentation and code example for more details. 
 
 
<ej-button id="btn" click="updatecolumn" text="Apply" /> 
 
<ej-percentage-text-box id="percentage" value="75" /> 
 
<ej-grid id="OrdersView" allow-scrolling="true" datasource="ViewBag.datasource"> 
    <e-columns> 
        <e-column field="OrderID" header-text="Order ID" width="80"></e-column> 
        <e-column field="CustomerID" header-text="Customer ID" width="80"></e-column> 
        <e-column field="EmployeeID" header-text="Employee ID" width="80"></e-column> 
        <e-column field="Freight" header-text="Freight" format="{0:N}" width="80"></e-column> 
    </e-columns> 
</ej-grid> 
 
<script type="text/javascript"> 
    function updatecolumn(args) { 
        var gridobj = $("#OrdersView").ejGrid("instance"); 
        var rows = gridobj.getRows(); 
        var value = $("#percentage").ejPercentageTextbox("getValue"); 
        var colindex = gridobj.getColumnIndexByField("Freight"); 
        for (var i = 0; i < rows.length; i++) { 
            gridobj.setCellText(i, colindex, value/100); 
        } 
    } 
</script> 
 
 
We have prepared a sample for your reference. Please refer the below link for the sample. 
 
 
Please get back to us if you have further queries. 
 
Regards, 
Vignesh Natarajan. 
 



NE Neider March 1, 2019 05:09 PM UTC

A lot of thanks, it worked perfectly.



SE Sathyanarayanamoorthy Eswararao Syncfusion Team March 4, 2019 04:16 AM UTC

Hi Neider, 
  
We are happy to hear that your issue has been resolved. If you need any further assistance, please get back to us. 
We will be happy to assist you. 
  
  
Regards, 
Sathyanarayanamoorthy 


Loader.
Live Chat Icon For mobile
Up arrow icon