I have a table where there are filters for it:
Asyoucanseeintheimage,foreachcolumnIhaveafilterwhereuserscantypewhattheyunderstandtodotheresearchtheyunderstand.IamnowallowingtheusertodownloadthePDFlistingwiththefiltersapplied.SoI'mcreatinganarraywiththefilterswhereIthensendthesamearraytoafunctioninanapplicationcontroller.Sogood!
Problem:
IftheuserinafilterwritesforexampleBelém,Lda
,andsincethereisacommainthisfilter,Iwillcreateanotherpositioninthearrayandnotcreateacompletestringatanarrayposition.
WhatI'mthinkingofdoingis:divideeachpositioninthearraywithacharacterthattheuserdoesnotuse,suchas☺
(smile)
Doubt:
TogetthefilterdataI'musing(usecomponent DevExpress where they provide javascript functions to be able manipulate data, in this case filterEditorState
to fetch the data from the filters):
var myArray = gvSortingListagemGARs.filterEditorState; //Devolve um array com todos os filtros
I know I can build the array as follows:
var pos1 = gvSortingListagemGARs.filterEditorState[1];
var pos2 = gvSortingListagemGARs.filterEditorState[2];
var pos3 = gvSortingListagemGARs.filterEditorState[3];
...
And then put all the data in an array, always putting ☺
at the beginning and end of each string.
Is it possible to build an array soon and change the position divider? So I avoided making N lines and simplifying my code.