0

I looked at all the relevant examples, but haven't found a solution yet that would work for me. I want the cell to be highlighted if it has validation error. I tried the a solution from stackoverflow that makes use of checkValues but it didnt work as in the following

$.jgrid.checkValues = function(val, valref, g, customobject, nam)

g, customobject and nam are undefined and I can't figure out what these parameters are for.

My validation is calculation based, so I tried custom function in the edit rules. It works, but I don't want a popup dialog, I want to highlight the cell with validation error.

fvrghl
  • 3,642
  • 5
  • 28
  • 36
Gomti
  • 1
  • Can you add the link to the SO question you are talking about – fvrghl Sep 19 '13 at 19:39
  • Adding the link to [resolution](http://stackoverflow.com/questions/5988767/highlight-error-cell-or-input-when-validation-fails-in-jqgrid/6162086#6162086) so others can find it . – urOutsourced Jun 01 '16 at 13:19

1 Answers1

0

I can't find the example but I have the snippet from that answer

 var originalCheckValues = $.jgrid.checkValues,
            originalHideModal = $.jgrid.hideModal,
            iColWithError = 0;
       $.jgrid.checkValues = function(val, valref, g, customobject, nam) {
            var tr, td,
                ret = originalCheckValues.call(this, val, valref, g, customobject, nam);
            if (!ret[0]) {
                tr = g.rows.namedItem(lastSel);
                if (tr) {
                    $(tr).children('td').children('input.editable[type="text"]').removeClass("ui-state-error");
                    iColWithError = valref; // save to set later the focus
                    td = tr.cells[valref];
                    if (td) {
                        $(td).find('input.editable[type="text"]').addClass("ui-state-error");
                    }
                }
            }
            return ret;
        };
Gomti Mehta
  • 45
  • 1
  • 10
  • Hi Oleg, this snippet is from the your answer to that post. Was wondering if you could help me with this question. – Gomti Mehta Sep 20 '13 at 14:56