I can not get the search function to work
I can not get the search function to work
Boomthabox
Posts: 19Questions: 3Answers: 0
I am trying to get my search function to work and I read this:
Add "searchable: false" to the first column configuration and it will start working!
I am not sure I put the "searchable: false" right where it should be but I hope someone can help me out and if this is the problem.
Link:
http://www.deltor.se/Editor-PHP-1.9.3/examples/simple/server-side-processing.html
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Since you are using server-side processing (which is only really useful if you have 10k or more records), then the server doesn't know anything about your client-side generated columns - in this case your first one.
So change:
to be:
Allan
Thanks! Now it is working
Oh now I just added to use image uppload (upload-many.html) and now the search is not working again, what am I doing wrong here? Hahaha
Its hard to say just by looking at some code. What's happening? Doesn't look like your test case is updated with the file upload. Go through the debugging steps from your other threads and let us know what you find.
Kevin
You would need to add
seachable: false
to the files column, as you did before.Colin
Thanks for reply, I have "searchable": false, but maybe I have put it wrong in the code? I have tryed to find what is wrong but I can not see and maybe I do it wrong. I send the link so you can see the script in action
"DataTables warning: table id=example - Unknown field: files (index 5)"
http://www.deltor.se/Editor-PHP/examples/simple/server-side-processing_con.html
Also to the script above (the link) I try to get upload image (upload-many) to work but get "A server error occurred while uploading the file", maybe you have the possibility to help me with this also, I don't know if there is a connection.
Thanks in advance!
/Alex
I just saw I have "searchable": false, two times in the scrip so now it is working
But the problem with uploading files (images) is still there. Hope someone here can help me fix this problem
"DataTables warning: table id=example - Unknown field: files (index 5)"
http://www.deltor.se/Editor-PHP/examples/simple/server-side-processing_con.html
Thanks in advance!
/Alex
As Colin said:
Which is this column:
```js
{
data: "files",
"searchable": false, // add this line
render: function ( d ) {
return d.length ?
d.length+' image(s)' :
'No image';
},
title: "Image"
}
````
Look at the browser's network inspector to see what is returned. Steps in this technote. You will see this error:
Looks like the paths you defined aren't there or there is a permissions issue.
Kevin
Ok, thank you very much for the help! Very nice, now it is working perfect! I am new to this but must say very good forum, 5-stars
/Alex
Is it possible to use PDF files also to upload?
/Alex
You should be able to use any file type, though you can also restrict the file types too. This example here, if you look at the "server script" tab, only permits image files,
Colin
The thing is that I would need to be able to upload any file type but mostly pdf, doc and xls files. Is that possible? What would I need to change?
Also I would need to be able to list the uploaded files with a link on each to be able to open them in a new window, instead of "1,2,3 etc image(s)". Is this possible?
/Alex
"but mostly" doesn't sound like a rule ... but anyway Colin gave you the answer. Please look at his linked example! It is one of the validators of the server script.
The second question I don't understand. Do you mean to have a link in the data table?
This could also help:
https://datatables.net/forums/discussion/comment/116151/#Comment_116151