How can i search all the meta data
How can i search all the meta data
I am formattign all the values in one and sending them as a html content. I have a search for this but it does not search the meta data(all the fields that I have included) except the original value itself(Ol.comment) on the client side. How can i make it to search everything
$('input', this.footer()).on('keyup change', function () {
if (that.searchTimer) {
clearTimeout(that.searchTimer);
}
if (that.search() !== this.value) {
that
.search(this.value)
.draw();
}
});```
```php
Field::inst('OL.comment', 'comment')
->getFormatter(function ($val, $data, $field) {
$details = [
['key' => 'U1.username', 'label' => 'Operator'],
['key' => 'OM.Mode', 'label' => 'Mode'],
['key' => 'EB.EB', 'label' => 'EB Type'],
['key' => 'OL.speed', 'label' => 'Speed'],
['key' => 'Y2.yesNo', 'label' => 'Flats'],
['key' => 'OL.oscRating', 'label' => 'Rating'],
['key' => 'OL.vatc', 'label' => 'VATC Reboot'],
['key' => 'Y3.yesNo', 'label' => 'Braking/Propulsion'],
['key' => 'Y1.yesNo', 'label' => 'Out of Service'],
['key' => 'OL.dos', 'label' => 'Door Operations Switch'],
['key' => 'Y4.yesNo', 'label' => 'Are you Properly Berthed?'],
['key' => 'OL.qfmID', 'label' => 'QFM #'],
['key' => 'U4.username', 'label' => 'Other Operators']
];
$comment = $val; // Starting with the original comment value
$commentReturn = '';
foreach ($details as $detail) {
if (isset ($data[$detail['key']]) && !empty ($data[$detail['key']])) {
$value = $data[$detail['key']];
$label = $detail['label'];
if ($label == "Door Operations Switch") {
if ($value == 1) {
$value = "Manual";
} else {
$value = "Auto";
}
}
$commentReturn .= '<br>
[' . $label . ': ' . $value . ']
';
}
}
Answers
Are you using server-side processing? If so, the search is done in SQL so any formatting added in PHP wouldn't be searchable.
Can you link to the page showing the issue so I can understand the issue a little more?
Thanks,
Allan
Hello Allan,
Yes, I am using server-side processing.
this is the site page "https://stagingc.assettrack.cx/operations/DailyLog.php". Check for the column description
I already sent you the credential before in DM.
THanks
Hi,
Thanks for reminding me! Good to hear from you again.
I'm currently getting:
When attempting to login (the number doesn't increase if I try to login again).
That said, if the issue is that you can't search for
Manual
orAuto
, then that is because of the text resolving in PHP. As I say, the search is performed in SQL, so by the time the PHP renderers run, it is already too late.One way to resolve this is with an SQL VIEW that will resolve the text formatting logic for you, or if it is possible to do it in the SQL SELECT statement with some logic, then we might be able to use that, but it isn't clear to me that is the case.
Allan
username: [retracted]
pass: [retracted]
The issue is not with the Manual or Auto instead searching the values that are rendered.
Do you mean things like:
?
If so, then that is the same issue. The search is being done before the rendering action.
Is this an editable table? If not, then I'd suggest doing the formatting logic in an SQL VIEW, and direct the Editor PHP instance to read from that VIEW.
Allan
Yes, the table is an editable one. With keeping the formatting like this and not use a view where/how can i change the sql statement to change the search logic for this column.
Thanks