jQWidgets Forums

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts

  • SandBird
    Participant

    Answering my own post but just in case someone is looking for a solution, I have managed to solve the aforementioned challenge by using columntype: 'custom' together with combination of createEditor with a select event on the jqxDropDownList. In the select event I do endcelledit and then setcellvalue.

    I think using the custom cause it not to loop because it creates a unique id tag (using row index as suffix).

    I tested it vigorously and so far I didn’t encounter any of the problems I mentioned before and it works as expected.


    SandBird
    Participant

    Hello Peter,

    I apologize to revive this yet again but since I also encountered the same issue I wanted to ask about it.

    Following the examples on the site (and then some), I have the following validation check (simplified version):

    validateEverPresentRowWidgetValue: function (datafield, value) {
    					switch (datafield) {
    						case "name":
    							if (value.length == 0) {
    								message = "Name field must be bigger than 0 characters";
    							} else if (value.length > 45) {
    								message = "Name field must be smaller than 45 characters";
    							} else if (value.replace(/\s/g, "") === "") {
    								message = "Please enter a valid input";
    							} else {
    								$.ajax({
    									...some ajax code where variable uniqueValData
    									is assigned an appropriate value if entered value is unique.
    								});
    								if (uniqueValData !== 0) {
    									message = "This value already exists, please enter a unique value";
    								} else {
    									return true;
    								}
    							}
    							notification("error", message, "#dataGrid"); //built-in function to utilize jqxNotification
    							return { message: message, result: false };
    						break;
    					}
    					return true;
    				}

    The problem, as the previous users noted, is that this it runs twice on the same editor. In the case above the function will iterate twice for the “name” editor – I know this because I get two notification prompts.
    Shouldn’t the function run only once? or at least per the switch (datafield) it should only validate once for the “name” editor. Otherwise I see it goes twice also to the database to check (I see two same consecutive ajax calls) which I don’t see a reason to.

    You mentioned (in post #74421) that ” Otherwise, you can add own custom validation logic and do not use our validation functions.” I am unsure if you are referring to something else than the above and if so I would appreciate if you can please share or point to where I can see how to do that.

    Thank you for your time clearing the confusion about this.

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