There are various other resources if you type "server-side processing POST" into the search box at the top of the page, but the above two should be sufficient.
You said before that then you added type: 'POST' into there that it sorted working. I would like you to add it back in so I can take a look at the error.
in a couple of columns. If you replace that (for example in the first column) with id it will work.
That is required for server-side processing since the server needs to be told what column to sort order when it is submitted for sorting (it can't sort on the rendered data, since you are doing the rendering on the client side in this case).
How can I replace {
render: function ( data, type, row ) {
// Combine the first and last names into a single table field
return data.adresse+' '+data.cp+' '+data.ville;
}
},
As I say, the server needs to know what data to sort on for that column. So you would set columns.data to whatever the database field name is that you want to sort on for that column. If you don't want sorting for that column, use columns.orderable to disable it.
Replies
Well, I don't even know that I use GET, how can I use POST? What's the difference?
Thank you very much Allan.
It says // Build our Editor instance and process the data coming from _POST
and I put "TYPE": "POST" so I really don't know
looks like my problem is USING serversided POST and EDITOR? Can't find any example with this working.. :(
up
There is an example of using Editor with server-side processing here: https://editor.datatables.net/examples/simple/server-side-processing.html .
Note specifically the DataTables Ajax initialisation:
There is also a server-side processing POST example here: http://datatables.net/examples/server_side/post.html .
There are various other resources if you type "server-side processing POST" into the search box at the top of the page, but the above two should be sufficient.
Allan
isn't this exactly the same code as I gave you????? That isn't working
And I have "DataTables warning: table id=datatabletest - Unknown field : index 0" as error
I would also add that it's working with this server side script : http://datatables.net/examples/data_sources/server_side.html
but not with the one I have with editor sever side...
I'm sure my problem is from this file :
Yes. But it is not the code that the example you linked to is using:
You said before that then you added
type: 'POST'
into there that it sorted working. I would like you to add it back in so I can take a look at the error.Allan
So is it now, Cause I was working with WAMP sorry
There are a number of JS errors on the page:
Editor.models.fieldType
to$.fn.dataTable.Editor.models.fieldType
to resolve.Allan
Updated, still an error..
note :
the problem happen when I add type: "POST"
to the
ajax: {
url: "php/table.datatabletest.php",
and if I don't, it loads all the data in the same page.
Okay good.
So the problem is being cause by the use of:
in a couple of columns. If you replace that (for example in the first column) with
id
it will work.That is required for server-side processing since the server needs to be told what column to sort order when it is submitted for sorting (it can't sort on the rendered data, since you are doing the rendering on the client side in this case).
Allan
How can I replace {
render: function ( data, type, row ) {
// Combine the first and last names into a single table field
return data.adresse+' '+data.cp+' '+data.ville;
}
},
or
{
data: null,
className: "center",
defaultContent: '<center><a href="" class="editor_edit" title="Editer"><img src="images/edit.png" width="16" height="16" border="0"></a> <a href="" class="editor_view" title="Voir"><img src="images/view.png" width="16" height="16" border="0"></a> <a href="" class="editor_remove" title="Supprimer"><img src="images/delete.png" width="16" height="16" border="0"></a></center>'
}
by removing data : null?
I would leave the rendering function as you have it, but also assign a value to data - in the case of the first column
id
as I suggested above.Allan
Kk for column with only one data it works, but for columns with concatenation, or options list like :
OR
dunno how to do it so it let me sort it after...
As I say, the server needs to know what data to sort on for that column. So you would set
columns.data
to whatever the database field name is that you want to sort on for that column. If you don't want sorting for that column, usecolumns.orderable
to disable it.Allan
Thank you very very much ! It works fine now ! :)
up
up
up