Set a default value to Column Filter

Publicado aproximadamente 17 horas atrás por Support WorkWithPlus

Postar um tópico
Não respondido
Support WorkWithPlus
Support WorkWithPlus Administrador

1- Introduction


Occasionally we need to have filters by default that are loaded when entering the screen so that we do not have to enter them every time we want to search by the same value.

For example, suppose we have a transaction that has different states loaded into an attribute, states like “open,” “closed,” “waiting,” etc. As they are fixed values, we can load them into a domain with enumerated values.

Every time we visualize the records, we want to show one of these states by default to facilitate the user's task. The solution we propose is to load an 'Enum Value' by default in the column filters.


2- Requirements

  • This works only if you have Optimization Number = 8 or higher.

3- Setting values


Open the web panel generated by WorkWithPlus for the “Default List”, for example, ProjectWW. Go to the Events tab and look for the 'LoadRegFiltersState' Sub.

At start of this subroutine, add the following code (replace all <ATT_NAME> with the attribute name):

If &HTTPRequest.Method = HTTPMethod.Get
   &TF<ATT_NAME>_Sels = new()
   &TF<ATT_NAME>_Sels.Add(Status.Open) //Default Enum Value that you want as default
   WWP_GridStateAddFilterValue(&GridState, !"TF<ATT_NAME>_SEL", true, 0, &TF<ATT_NAME>_Sels.ToJson(), '')
 EndIf 



It has to look like this:

ColumnTitleDefault1


4- Running example:

ColumnTitleDefault2

0 Votos


0 Comentários

Entrar ou Registrar para postar um comentário