Performance wise, there should not really be any performance issues -
if you do it right.
A good reason to use jQuery for this is to separate coding from
markup, and also your data (RN, Location A, 1 Shift, etc.) from your
coding. Also, like you said, it'll keep the page's filesize small. If
your server supports gzip, it'll be even smaller. If you keep your JS
code on a separate file, minified, and gzipped, it's even better.

The main bottleneck is attaching the onclick event to every link, and
having hundreds of links. This basically would mean you would have to
do an event bind hundreds of times which, processing-wise, will be
slow.
The solution is using event delegation. Basically you just bind an
onclick once to the parent element of all the links (probably your
table). Anytime someone clicks within that element, you'll fire that
click event, which will check whether the user clicked on your valid
link or not (eg. images, or other text within the table). If not,
ignore. If so, do your Javascript.

Since your links will need to provide some kind of reference to the
data, you'll have to give each link a unique id attribute so that your
Javascript code can use to call the associated data with the clicked
link. Hopefully your data does have some kind of unique ID for each
row. All the data you can separate and have organized into JSON
format, or as a set of arrays, whichever you prefer.

Here are some links to get you started on event delegation:
http://www.learningjquery.com/2008/03/working-with-events-part-1
http://lab.distilldesign.com/event-delegation/

Hope that helps.

On Apr 1, 11:42 am, Adam Patt <adamp...@gmail.com> wrote:
> I am setting an onClick for many rows doing this:
>
> <a href="javascript:copy_value_popup({'position': 'RN', 'location' :
> 'Location A', 'shift' : '1st Shift (7a-3p)'},
> 'loc_41_sht_59_stt_69');">copy</a>
>
> I could set this information as attributes in other parts of the table
> structure to get what I needed to make a way to wire these up via
> jQuery.  I could have hundreds of these links to wire up.  I know that
> my current way will produce more html that the page will have to
> download and process, but is there likely to be any noticeable
> performance difference between doing a static link like this vs.
> jQuery setup in $(document).ready when it comes to page loading or
> general JS page performance?

Reply via email to