Pagination plugin creation, .data trouble
Hello,
I m doing my first plug-in with jQuery, I'm building a pagination one.
- I want it to be used for more than one pagination on the same page (maybe not useful for a pagination, but I need to learn how to use a plug-in on several item in a page with different params for each items.)
- I want to ad as a param the area to update, that's work, but I can't lets those data to be available at any time. I'm trying to link those with .data() on the pagination div. When I do the first click, it work, the second work to, but the data link is lost, so my .data() method return an error.
There is a lot of consol.log in the script to see what's happen.
Here is how to call the plug-in
- $('.pagination').pagination({
- target: {
- content: '#conso_table',
- pagination: '.pagination'
- },
- script_file: 'con_gzn_edit_quantite.php'
- });
- content: is the target area to update with the content
- pagination is the target area to update with a new pagination data provided by the web server(php) trough an xml file
XML file
- <request>
- <content> content to show (in html) </content>
- <pagination> pagination content (in html) </pagination>
- </request>
In the xml as in the plug-in calling script, it's possible to add more than content and pagination area, by exemple, you have 2 areas to update with your content, just add a
key : value in target and add a
< tag> html content
in the xml, the plug-in will update areas by itself.
html
- <div class="pagination"> 1 2 ... </div>
- <div id="conso_table"> content to paginate </div>
- <div class="pagination"> 1 2 ... </div>
If somebody can help me, that will be greeat.
Regards,
twentyeight