jQuery UI Widgets Forums Grid jqxNotification instead of default cell validation message

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

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

  • jgarcias
    Participant

    I am having issues with the default cell validation messages, especially when validating the first column in my jqxGrid, the message is displayed at the bottom of the cell and to the left so it is not possible to read the whole message. It would be nice to center it or having a jqxnotification instead of that default message.
    If relocating the default message is not possible, how about using a notification message? any example?


    Martin
    Participant

    Hello jgarcias,

    The default validation message of the grid has position: absolute so you can relocate by changing the top and left styles properties of the elements with classes jqx-grid-validation-arrow-up and jqx-grid-validation.

    Otherwise, you could use the cellendedit event to perform custom validation with jqxNotification. You have both the old and the new value in the event arguments so you can undo the cell value and open the notification element, if needed.

    Best Regards,
    Martin

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


    jgarcias
    Participant

    Hi Martin

    Thank you for your answer.
    I decided to go for the cellendedit event and perform my custom validation. Everything works as expected except for one small curious thing: the jqxNotification is showing twice. I have dug in my code to see if I wrote something wrong but I can’t find it.

    Here is my code for the validation:

    
            {
               text: gridHeaders[0], dataField: 'memberName', renderer: function (text, align) {
                  return '<div class="gridHeader">' + text + '</div>';
               },
               cellendedit: function (row, datafield, columntype, oldvalue, newvalue) {
                  if (newvalue == "") {
                     $('#validationMsg').jqxNotification("open");
                     $('#grid_2').jqxGrid('selectcell', row, datafield);
                     return false;
                  }
                  else {
                     return true;
                  }
               },
               width: 213,
            }
    

    Besides that function there is no other one calling or activating my jqxNotification object.

    Any clue of why is this happening?


    Martin
    Participant

    Hello jgarcias,

    You are right, the cellendedit column callback is called twice.
    Instead, you could use the cellendedit event of the grid. Please, take a look at the following Example.

    Another option is to use a flag to know when to open the notification. You can see this Example.

    Best Regards,
    Martin

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


    jgarcias
    Participant

    Hi Martin

    Beautiful !!
    I went for cellendedit event of the grid and that solved my issue.

    Many thanks!

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

You must be logged in to reply to this topic.