-
Notifications
You must be signed in to change notification settings - Fork 490
Angular datatables ajax pagination using nodejs and mongodb #710
Comments
I'm getting this error:
|
Several points:
|
I have updated my question, pls see.
|
In the |
Then How I can pass a string into showModel() like: |
When I used this method:
Getting this error:
|
It's a string, so you need add quotes: .renderWith(function(data, type, full, meta) {
return '<button class="btn btn-warning" ng-click="showModal(\'' + data._id + '\')">' +
' <i class="fa fa-edit"></i>' +
'</button> ' +
'<button class="btn btn-danger" ng-click="deleteItem(\'' + data._id + '\')">' +
' <i class="fa fa-trash-o"></i>' +
'</button>';
}) |
Thank for your help, I want to show image in table, is it possible? |
Okay I got the solution:
|
Search issue. |
You can trigger a search by using : You can then monitor the ajax request that is made to the server. Check the following documentation : https://datatables.net/manual/server-side |
Okay let me try |
Hi, I'm using now on button click searching feature and I see in request search value is atached this way:
|
Check the navigator network monitor tab (use development tools from Chrome or Firefox). Check the parameters from the POST request, you will see a JSON object, this is the one you will get on server side. To retrieve it, depending on the language you use, will be as simple as retrieving a POST object and then parse it from json to a dictionnary. Using python with Flask and the request module, I can then write :
For php, it would be :
Take a look at the documentation for a full list of the variables you can use. You can even send your own custom variables from the client-side and catch them on the server-side. |
Hi, But the issue is my mongodb not search this value, here is my function;
|
This is your client side function, you need to check your server side. It sees the search value, so you need to check your query. |
No this is my Server side function and I get |
Cannot help you without further details (specially your find function) |
Hi, |
I don't know enough about NodeJS to be of any help, you can check the documentation https://docs.mongodb.com/getting-started/node/query/ and check your |
@shahzadthathal take a look at https://github.com/fiddus/datatables-query, a module that I wrote to perform server-side rendering for datatables, using Node.js (w/ express) and MongoDB (w/ mongoose) on the server. |
Hi I will give it a try. Thanks |
Uh oh!
There was an error while loading. Please reload this page.
I'm trying to implement server side pagination in angular datatables but unfortunately I'm completely failed, can some one pls have a look into my code. No product showing in table, how I can initially fill $scope.products array? How I can then use ajax pagination? how I can pass page no, limit? Also pls look into server side function too. Any help would be highly appreciated!
ProductCtrl:
Product.html
Product Data from server
I wan to pass object to showModel() function but getting this erorr:
The text was updated successfully, but these errors were encountered: