3
I have a table where there are filters for it:
As you can see in the image, for each column I have a filter where user can type whatever they want to do the search they understand. Now I am allowing the user to download the listing in PDF format with the filters applied. So I’m creating an array with filters where I then send the same array to a function in an application controller. So far so good!
Problem:
If the user in a filter writes for example Belém, Lda
, and since there is a comma in this filter, I will create another position in the array and not create a complete string at an array position.
What I’m thinking of doing is: divide each position in the array with a character that the user does not use, such as a ☺
(Smile)
Doubt:
To fetch the filter data I am using (I use Devexpress where javascript functions are available to handle data, in this case the filterEditorState
to retrieve filter data):
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 together in an array, always putting one ☺
at the beginning and end of each string.
It is possible to immediately construct an array and change the position divider (comma)? So I avoided making N lines and simplifying my code.
Regarding "Smile" I think it’s better to have a string type password. I still don’t understand the problem. You want to change the array you receive in
var myArray = gvSortingListagemGARs.filterEditorState;
or find an alternative to generate the array?– Sergio
I wanted to find an alternative to generating the array. Where I could work around the comma question in a filter string. The solution I thought was to filter the respective string, but then I wondered if there is another solution to solve this
– CesarMiguel
But even with sub-arrays and if you use split, a search string can be compromised (for example
Belém, Lda
)– CesarMiguel