javascript - angular-datatables payload format does not change upon subsequent calls to reloadData() -


By using the initial load of data in the table using the angular-datatable (), I want to change the date range for which Reload and display data period is selected using the input field two days from time to time. However, all subsequent requests do not modify the time-line parameters in the dtOptions obeject.

The strange thing is that, when I change the modified dtOptions objects, the changes begin to take effect, that is, the data property of dtOptions Demonstrates the request in the "Networks" tab of "Developer Tools" in Chrome, indicating that the old deadline values ​​are still used, which are not updated in table entries.


Example:

Whenever I post for new data

getting it in the "Networks" tab of "Developers Tools" is from {to, from} is:

  Origin: http: // localhost: 9000 Referer: http: // localhost: 9000 / user-agent: Mozilla / 5.0 (X11, Linux x86_64) ChromeWebKit / 537.36 (KHTML, like Lizard) Chrome / 37.0. 2062.120 Safari / 537.36 Form DataView sourceview URL Encoding - & gt; From: 1412172055200 - & gt; To: 1412690455222   

Although it is the equivalent in the "console" tab, when issuing console.log ($ Scope.dtOptions); Really shows me the time frame already selected.

  object {ajax: object, reload: true, integrateBootstrap: false, hasColVis: false, hasColReorder: falseĆ¢ ?? |} Ajax: Object Data: Object - & gt; From: 1412518000453 - & gt; To:: 1412690800493 __proto__: Object datatype: "json" type: "post"   

to rewrite with rewrite and several methods Trying to do $ scope.dtOptions.reloadData () : The value written in the payload before calling, written directly to $ scope.dtOptions.ajax.from , to pass directly Attempted payload object, and the latest effort (code below to give an idea) updated - newOptions () to dtOptions Object again Used to make

  var payload = {to: TFRM, from: TTO}; $ Scope.dtOptions = DTOptionsBuilder.newOptions () .withOption ('ajax', {url: constantCfg.apiEndpoint + constantCfg.uri.usersStats, type: 'POST', data: payload}); $ Scope.dtOptions.reloadData (); Console.log ($ scope.dtOptions); & Lt; -   

The 'console' tab discussed above causes the production, updating the payload values ​​in all ways, when printed in the "console" tab, but still The request in the "Networks" tab indicates the use of the old deadline values.

Payload There was no reason to update any additional warnings or errors in the object.

In fact, you can enter ajax.data as a code Need to define and define your criteria for sending the server.

  var = 1412518000453 from = 1412690800493; $ Scope.dtOptions = DTOptionsBuilder.newOptions () .withOption ('ajax', {url: constantCfg.apiEndpoint + constantCfg.uri.usersStats, type: 'receiving' data: function (d) {d.from = to; D .to = to;}}); $ Scope.reloadData = function () {// Calculate the variable from / to your = 1412518000463; From = 1412690800593; $ Scope.dtOptions.reloadData (); };    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -