Solved

jQuery Datatables with server side processing: fnAddDataAndDisplay

Posted on 2013-01-29
5
1,313 Views
Last Modified: 2013-02-05
I am using datatables 1.9 with server side processing.  I would like to add new records and display the newly added records.  When not using server side processing I can use the fnAddDataAndDisplay() function.  

Is there a method or technique similar to fnAddDataAndDisplay() that works with server side processing?

For instance, I could add the record - locate the record with a query - and have datatables go to the correct page.  However, I can not locate a method to make datatable go to the page I want.

Thanks!
0
Comment
Question by:HyperBPP
  • 4
5 Comments
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 500 total points
ID: 38833902
0
 
LVL 6

Author Comment

by:HyperBPP
ID: 38835774
Almost works.  However, adds the row to the displayed rows and sorts based on the displayed rows rather than all data available on server side.  Probably not a function to work with the server side data.... hmmm.

However, the iDisplay start propery may be what I'm looking for.   this would let me go to the desired page.  I just may have to do an extra server side call to calculate the page and write an extra server side source page that does this.

But, I need to know if my table is using server side processing or not.  I have both types of tables in my app.  Know of a property that can True/False the server side of the table?
0
 
LVL 6

Author Comment

by:HyperBPP
ID: 38835804
Ah-ha!

oSettings.oFeatures.bServerSide
0
 
LVL 6

Accepted Solution

by:
HyperBPP earned 0 total points
ID: 38840553
So I created a server side and made an ajax call on once the data was added and update the table to the position

queryString = '?iDisplayLength=' + oSettings._iDisplayLength + '&iSortingCols=1' + 
						'&sSearch=' + oSettings.oPreviousSearch.sSearch  + '&sSortDir_0=' + oSettings.aaSorting[0][1] +
						'&iSortCOL_0=' + oSettings.aaSorting[0][0] + '&record=' + response["UUID"] + 
						'&name=' + $.urlParam('name');

$.ajax({
					url:'DB/CFM/dataTablePositionAjaxForm.cfm' + queryString,	
					dataType:"json",
					success: function(data, textStatus,jqXHR){
						//go to position
						
						alert(data["sStart"]);
						oSettings._iDisplayStart = data["sStart"] - 1;
						oSettings.oApi._fnDraw( oSettings );
						
						
					}});

Open in new window

0
 
LVL 6

Author Closing Comment

by:HyperBPP
ID: 38854303
Posted the final answer.  Leakim's answer contributed to the knowledge.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

920 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

16 Experts available now in Live!

Get 1:1 Help Now