Solved

Need to override the keyup function with a home grown function

Posted on 2011-09-21
5
354 Views
Last Modified: 2012-05-12
I have a jqGrid validation methodology that's killing performance, due to the fact that the validateDuplicates function is being injected into the keyup event. I want to use my own function which would only return true if a duplicate is found, and at that point a performance hickup is okay.

Can someone tel me how to make up my own function, and make it chainable?

Right now I have this:
$('[id^="Container_"]).keyup(validateDuplicates).change(validateDuplicates);

I need (at least I think I need) to write an alternative to keyup, call it displiatesFound. And in there I'd add each barcode to a list, after checking if it already existed. If it did exist, two duplicates are found.

Thanks!
0
Comment
Question by:newbieweb
  • 3
  • 2
5 Comments
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36578152
why don't you simply unbind the keyup event and see what happens?
0
 

Author Comment

by:newbieweb
ID: 36578167
Not sure what you mean by unbinding...
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 36578176
$('[id^="Container_"]).unbind("keyup");
0
 

Author Comment

by:newbieweb
ID: 36578199
But then what action (or event) would call the jquery default error code?

Here's what I was going to do. Please tell me if this will work. Oddly, it seems to and I have not yet even created my own duplicates test. I planned to insert it inside the anonymous function I created.

$('[id^="Container_"]).keyup(function () {
     validateDuplicates()
}).change(validateDuplicates);

What do you think?
0
 

Author Closing Comment

by:newbieweb
ID: 36578249
I think my code unbinded it in a different way. Thanks.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now