DataTables With SearchBuilder (On columns with input value not beeing recognized) Using AngularJS
DataTables With SearchBuilder (On columns with input value not beeing recognized) Using AngularJS
Gr13z
Posts: 3Questions: 1Answers: 0
Hello!
I can't show enterprise code but i will give some code excerpts to interpret my problem.
<table id="stockTbl" class="table table-striped table-condensed compact table-responsive" datatable="ng" dt-options="dataTableOptions" style="margin-left:-15px; margin-top: -9px;">
So i have on
tr ng-repeat: temp in stock
and one of td is
<td ng-style="{'background-color': getColor(temp)}">
<input
ng-model="temp.qty"
ng-change="validaQtdPcs()"
style="width:45px;"
value="{{ temp.qty }}"
type="text"
><span ng-if="temp.qty != temp.qty_disp">({{ temp.qty_disp }})</span>
</td>
And dataTableOptions is
$scope.dataTableOptions = {
"dom": 'Qlfrtip',
"paging": false, // Enable or disable table pagination.
//"searching": false, // search abilities of DataTables to be enabled or disabled
"info": false,
"orderCellsTop": true,
"processing":false,
"paging": false,
"searchBuilder": {
"depthLimit": 1,
// change language Add Condition button
"columns": [
1
,2
,3
,4
//,5
,6
,7
,8
,9
,10
],
"i18n":{
// /"add": $scope.textos['1840']['TEXT'], // Adicionar*
"add":"<i class='fa fa-plus'></i>",
// /"button": {
// "0": "Filtros",
// "_": "Filtros (%d)"
// },*
"clearAll": "<i class='fa fa-trash'></i>", // Limpar Filtro
/*"condition": $scope.textos['257']['TEXT'], // Condicao
"value": $scope.textos['797']['TEXT'], // Valor*/
"data": "", //$scope.textos['352']['TEXT'], // Data
/*"logicAnd": $scope.textos['3507']['TEXT'], // E
"logicOr": $scope.textos['3508']['TEXT'], // Ou*/
"conditions":{
"array":{
"contains": "*",
"empty": "",
"equals": "=",
"not": "!=",
"notEmpty": "!"
},
"date": {
"after": ">",
"before": "<",
"between": "<>",
"empty": "",
"equals": "=",
"not": "!=",
"notBetween": "><",
"notEmpty": "!",
},
"number": {
"between": "<>",
"empty": "",
"equals": "=",
"gt": ">",
"gte": ">=",
"lt": "<",
"lte": "<=",
"not": "!=",
"notBetween": "><",
"notEmpty": "!",
},
"string": {
"contains": "*",
"empty": "",
"endsWith": "$",
"equals": "=",
"not": "!=",
"notEmpty": "!",
"startsWith": "^",
"notStartsWith": "!^",
"notEndsWith": "!$",
"notContains": "!*"
},
"moment": {
"contains": "*",
"empty": "",
"endsWith": "$",
"equals": "=",
"not": "!=",
"notEmpty": "!",
"startsWith": "^"
},
}
},
},
"columns":[
/*
FOR ALL COLUMNS IN TABLE (EXCEPT FIRST ONE) CONVERT THEM TO STRING TYPE
https://live.datatables.net/mezaxuxa/5/edit
*/
{visible:true}, // checkbox
{type:"string",visible:true}, // Artigo
{type:"string",visible:true}, // Lote
{type:"string",visible:true}, // Molde
{
type:"num"
,visible:true
,render: function (data, type, row, meta) {
// You can apply custom rendering if needed
return data;
}
}, // Quantidade
{type:"num",visible:true}, // Qtd Cx
{type:"string",visible:true}, // Unidade
{type:"string",visible:true}, // Estado
{type:"string",visible:true}, // Caixa
{type:"string",visible:true}, // Palete
{type:"date",visible:true}, // Data lote
],
"deferRender": true
}
For the column Quantidade that means Quantity in English, the value is beeing displayed on input. I add conditions on searchBuilder (the conditions = >= ... ) but they are not recognizing the values and the table always show the message "Not matching ..."
Anyone can help me?
Ty.
Answers
We would really need to see the issue to be able to debug this. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Colin
Hello,
I didn't give an answer earlier because it was the company's code that couldn't be replicated, not even close to that, so in my mini project I added the datatables part trying to copy some parts of the company's code and the final result is in the link below
https://github.com/LearningFromSchool/angular_project/
then transfer and execute the command in the directory: php -S localhost:8080, then the header link will be datatables and realize that the problem is that in the column where the value is presented in <input>, searchbuilder does not recognize the values and I would like to know how it is possible to recognize these values, as well as in terms of updating these values.
Thank you very much.
404 not found at that link I'm afraid.
Allan
Sorry for the misunderstanding. So the correct link is
https://github.com/LearningFromSchool/angular_training