Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #103255

    Hi I would like to be able to put decimals into a field of a GridComponent, specifically in a % input. This is the settings that I provided to the Grid Input:
    <div> { label: ‘% Margen’, width: 100, dataField: ‘margentarifa’, allowEdit: true, editor: ‘numberInput’, cellsFormat: ‘p2’, cellsAlign: ‘right’ }</div>
    <div>Thanks in advance.</div>
    <div>Kind Regards.</div>


    Don’t know why the <div> tags appear, sorry.



    A built-in input in percentage is having that behavior, because the actual number is already a decimal. For example: the data value is 0.2 = 20%. In the Grid you will see and edit 20%, but when you get the value of the cell, it will be 0.2.

    To achieve what you need, you can do the following:

                        label: 'City2', dataType: 'number', cellsFormat: 'n2', editor: {
                            template: 'numberInput',
                            numberFormat: {
                                style: 'decimal',
                                minimumFractionDigits: 2
                        }, formatFunction(settings) {
                            settings.value = settings.value + '%';
                        }, dataField: 'City2', width: 120

    Best regards,
    Peter Stoev

    jQWidgets Team


    Thank you so much!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.