jQuery UI Widgets Forums Grid numberinput field losing focus when there is an error

This topic contains 5 replies, has 2 voices, and was last updated by  mallepaddi 11 years, 4 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author

  • mallepaddi
    Participant

    Hi

    I am using “showvalidationpopup” to show an error again quantity field which is an numberinput field.

    when checkbox checked then opening quantity editor of that row using .. var editable = $(“#jqxgrid”).jqxGrid(‘begincelledit’, row, “qty”);

    what i need to know was … as long as there is an error, quantity field should not lose focus and should be in editor open state as it was before.

    At present … i am using “cellbeginedit” by returning false to make user not to select any other checkbox when there is an error.

    But when clicks some where in grid … message continue showing but field losing focus and appearing back to initial state.

    How to prevent it, not to lose focus as long as there is an error ..

    Thanks


    Dimitar
    Participant

    Hello mallepaddi,

    Is showvalidationpopup called in any of the column callback functions? Please share your implementation.

    As an alternative, you may use the validation callback function, as shown in the demo Editing (note the Quantity column).

    Best Regards,
    Dimitar

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


    mallepaddi
    Participant

    Hi

    Mentioned demo not having check box for selecting entire row and open an editor of Quantity field.

    In my case,
    Is it possible to achieve following functionality using “validation” callback on Quantity field ???

    1. Check check box should select entire row and open an editor of Quantity field – Done
    2. Error should be shown to enter Quantity for selecting row, error should disappear when the user unchecked check box or entered Quantity more than ZERO.
    3. If i use validation callback, it’s forcing user to enter Quantity, but not allowing user to unselected check box, how to implement it ?
    4. If error message appears then focus should always be in Quantity field, should not lose focus from Quantity field until user enters value

    Thanks


    mallepaddi
    Participant

    Hi

    I think i found a way of using combination of “cellclick” and “validation” callback..

    Thanks


    mallepaddi
    Participant

    Hi

    Following code works in FF but not in IE …

    validation: function (cell, value) {
    var datarow = $(productGrid).jqxGrid(‘getrowdata’, cell.row);
    if (datarow.selected === true && value <= 0) {
    return { result: false, message: "Enter Quantity (or) Unselect product." };
    }
    return true;
    }

    $(productGrid).on('cellclick', function (event) {
    var datarow = $(productGrid).jqxGrid('getrowdata', event.args.rowindex);
    if(event.args.datafield == "selected"){
    //checked state, now un-checked
    if(datarow.selected === true) {
    $(productGrid).jqxGrid('setcellvalue', event.args.rowindex, 'selected', false, true);
    $(productGrid).jqxGrid('unselectrow', event.args.rowindex);
    } else {
    $(productGrid).jqxGrid('setcellvalue', event.args.rowindex, 'selected', true, true);
    $(productGrid).jqxGrid('selectrow', event.args.rowindex);

    //Shows the cell editors for an entire row.
    //$(productGrid).jqxGrid('beginrowedit', event.args.rowindex);
    var editable = $(productGrid).jqxGrid('begincelledit', event.args.rowindex, "qty");
    }
    }
    });

    I am not able change state of checkbox in IE, but it perfectly fine in FF.

    Thanks


    mallepaddi
    Participant

    Above works in IE if there is an alert(‘ testing ..’); in “cellclick’ method.

    Thanks

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

You must be logged in to reply to this topic.