Editable row with number type

890 views Asked by At

How can i make this input type with number. I mean when the page is opened in mobile phone, it'll be open the number keyboard.

IMAGE

        [
        'class'=>'kartik\grid\EditableColumn',
        'headerOptions' => ['style' => 'width:10%', 'class'=>'text-center'],
        'editableOptions'=>[
            'asPopover' => false,
            'inputType'=>\kartik\editable\Editable::INPUT_TEXT,
            // Change here:
            'editableValueOptions'=>['type'=>'number']
        ],

        'attribute'=>'quantity',
        'label'=>'Quantity',
    ],

EDIT ->> add 'editableValueOptions'=>['type'=>'number']

2

There are 2 answers

5
Imtiaz On

Use editableValueOptions. As the documentation says:

editableValueOptions: array, the HTML attributes for the editable value displayed.

        [
            'class'=>'kartik\grid\EditableColumn',
            'headerOptions' => ['style' => 'width:10%', 'class'=>'text-center'],
            'editableOptions'=>[
                'asPopover' => false,
                'inputType'=>\kartik\editable\Editable::INPUT_TEXT,
                // Change here:
                'editableValueOptions'=>['type'=>'number']
            ],

            'attribute'=>'quantity',
            'label'=>'Quantity',
        ],
0
0leg On
    'attribute' => 'quantity',
    'class' => 'kartik\grid\EditableColumn',
    'editableOptions'=>[
        'valueIfNull' => 'not set',
        'inputType' => \kartik\editable\Editable::INPUT_HTML5,
        'options' => [
            'type' => 'number',
            'min' => '0.5',
            'step' => '0.5',
        ],
    ],

You should use options array as shown above