Comments (15)
That works. Thanks again for all the help!!
from datatables.
I'm checking.
from datatables.
I think I made it on purpose since it is not recommended to use dash in the columns. Using dashes (-) in column names is generally discouraged because many programming languages, databases, and tools interpret the dash as a subtraction operator or other special character.
you can use underscore instead.
from datatables.
If the column name has `` around it, it shouldn't cause any problems. I'd really like to avoid renaming all the columns in my database as it already has millions of rows and selecting as another name causes issues when I try and filter the column
from datatables.
what about using like this:
$dt->query("SELECT
`test-test` AS `test_test`
FROM
`test`");
In this case, you dont have to rename your columns.
from datatables.
Causes issues with filtering as test_test
doesnt exist in the database. Unless theres some way I can change the column?
$dt->filter('test_test', function () {
return $this->column = '`test-test`';
});
That doesn't work but is there a way to do that?
from datatables.
Not sure whats wrong.. Its working for me as expected.
from datatables.
and this is the default filtering
from datatables.
Can you show me the error you get ? maybe there is another problem ?
from datatables.
Sorry you are correct it does work. My request was just timing out because it was doing a LIKE search.
How do I make it do an exact search? This is the data being sent to the server
columns[9][data]: phone_number
columns[9][name]:
columns[9][searchable]: true
columns[9][orderable]: true
columns[9][search][value]: ^123456$
columns[9][search][regex]: true
Also is there a way to filter on multiple columns with OR? Say for example the column being searched is phone_number
I would like the query to be where phone_number = 'value' or some_other_column = 'value'
from datatables.
When you type in search input, all columns that has searchable: true
are being search with "LIKE" and merged with 'OR'.
Lets say, you need to filter by full text, then you can bypass default filter like :
$dt->filter('test_test', function () {
return $this->column->name.' = '. $this->escape($this->searchValue());
});
from datatables.
Thanks. Now how would I make that filter apply only when searchValue() has a value?
from datatables.
Ah sorry, here it is:
$dt->filter('test_test', function () {
if ($this->searchValue() === '') {
return;
}
return $this->column->name.' = '. $this->escape($this->searchValue());
});
from datatables.
I just looked at the getQuery() log and that still causes the search term to be added to the query when its empty
from datatables.
Yea you are right, can you try this one ?
$dt->filter('test_test', function () {
if ($this->searchValue() === '') {
return '';
}
return $this->column->name.' = '. $this->escape($this->searchValue());
});
from datatables.
Related Issues (20)
- Which method adds optional parameters to the row? HOT 1
- Multiple value coloumn order HOT 2
- Add support for Embedded DataTable from Editor HOT 1
- Conditional where clauses for PhalconAdapter HOT 1
- MySQL error on special column names HOT 5
- addIndexColumn / DT_RowIndex
- Laravel adapter does not work with PostgreSQL
- PhalconAdapter not working
- Export to Excel feature HOT 1
- datatable: data with function, doesn't work sort HOT 1
- Problem when using sql server in codeigniter 4 adapter HOT 2
- data as array are forbidden
- Skip Total Records HOT 2
- edit all columns HOT 5
- weird error with the sorting of multiple columns HOT 1
- Mysql PDO HOT 2
- Large Table Count HOT 2
- Filters HOT 3
- Support Mutiple schema with Postgresql HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datatables.