jQWidgets Forums

jQuery UI Widgets Forums Grid jqxgrid with numberinput

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 12 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • jqxgrid with numberinput #19403

    btpy
    Member

    Hello there. I’ve been trying to let user put only non-negative values into a cell with number input, but i haven’t succeeded.

    This stuff
    { text: ‘Price’, datafield: ‘dataPrice’,columntype: ‘numberinput’, cellsalign: ‘right’, width: 100,
    initeditor: function (row, cellvalue, editor) {
    editor.jqxNumberInput({ decimalDigits: 2, min: 0 });
    }
    didn’t help me,
    and this one too:
    $(“#jqxgrid”).on(‘cellendedit’, function(event){
    if (event.args.value < 0) {
    $("#jqxGrid").jqxGrid('setcellvalue', event.args.rowindex, event.args.datafield, 0);

    }
    });
    maybe, I_am_doing_it_wrong?
    thank you any way

    jqxgrid with numberinput #19405

    Peter Stoev
    Keymaster

    Hi btpy,

    Which version of jQWidgets do you use? In another post you pointed out that it is 2.5.5. If that is the version that you use, please upgrade to the latest one as the APIs that you use may still be not available in 2.5.5.

    Btw. for preventing incorrect input, you can use the “validation” callback.

                      {
    text: 'Quantity', datafield: 'quantity', width: 70, align: 'right', cellsalign: 'right', columntype: 'numberinput',
    validation: function (cell, value) {
    if (value < 0 || value > 150) {
    return { result: false, message: "Quantity should be in the 0-150 interval" };
    }
    return true;
    },
    createeditor: function (row, cellvalue, editor) {
    editor.jqxNumberInput({min: 0, decimalDigits: 0, digits: 3 });
    }
    },

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.