Skip to content Skip to sidebar Skip to footer

Creating Tables Dynamically In JQuery

I'm building some data dynamically using jQuery, but I'm getting the following error: Uncaught Error: HIERARCHY_REQUEST_ERR: DOM Exception 3 This happens at the app

Solution 1:

I would seriously reconsider what your doing. The mass of script is going to become unmaintainable and seriously hard to debug. Can you not do all this markup creation server side and use ajax to load it into the dom.

The way you have it at the moment is going to encounter performance issues also, especially if you have a large set of data. You are doing creating multiple jquery dom objects and doing multiple appends. It is better to build a string or push to an array and append to the dom only once. Each append causes a redraw which is expensive.

Failing that why not use a dedicated dom creation plugin to make your js more readable.

Another option is to look at jTemplates which will allow you to define the markup outside of the js and then pass in the data to be shown.

You may also consider using one of the grid plugins which are tried and tested and create the table structure for you efficiently. Google jqgrid or flexigrid.


Post a Comment for "Creating Tables Dynamically In JQuery"