kendo-uikendo-templatekendonumerictextbox

Do not show decimals in Kendo UI numericTextbox when declaratively binding in template


For some reason my numericTextbox is still showing a decimal and numbers after the decimal while in a kendo template. I followed the other answers by having the attributes of decimals="0" and format="#" but to no avail.

code:

<table>
            <tbody>
                # for (var i = 0; i < data.length; i++) { #
                    <tr>                    
                        <td>
                            <input type="number" data-role="numerictextbox" value="#= data[i].Copies #" 
                                decimals="0" format="\\#" min="1" class="copies" style="width:60px;"/>
                        </td>
                    </tr>
                # } #
            </tbody>
        </table>

Solution

  • When using declarative binding with Kendo UI, you must precede widget properties with data-. That's why decimals="0" and format="\\#" do nothing. Instead, write them as data-decimals="0" or data-format="\\#".