Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Fixed criteria for field

    Good morning,

    there is a way to specify a fixed criteria por field added to the searched value? For example, we have a IdentityDocuments DataSource where we declare a value (textField) and a type (enumField) where it can be id, passport, cif (for companys). In the Listgrid we declare a column for every type and show it using cellFormatter. When searching I want to pass the type of the IdentityDocument programatically beside the searched value or ordering field. Is that possible?

    Best regards
    Last edited by hespresati; 16 Sep 2014, 02:09.

    #2
    Just set initialCriteria on the ListGrid before it is drawn and any filter criteria entered by an end user will be added to this initialCriteria.

    Note: if you were trying to enforce a security constraint, the right way to do is with server-side handling, for example, operationBinding.criteria.

    Comment


      #3
      Good morning,

      initialCriteria doesn't do what I want, beacuse I want that functionallity per listGridField and not fot the entire listGrid. Thanks for your support. I'll keep diggin into the docs

      Regards

      Comment


        #4
        initialCriteria allows you to specify criteria for any field, or for multiple fields.

        Comment


          #5
          Now I know what you mean. Sorry! Thanks for your support

          Comment


            #6
            According to problem described in first post with initialCriteria we can't achieve a fixed criteria per ListGridField which has a dataPath shared with other types of Identity Document. For example:

            documentoIdentidad/valor <= value of Identity Document
            documentoIdentidad/tipo <= type of Identity Document (Personal Id, Passport, etc)

            In ListGrid we have defined persoalIdField and passportField. Both of them take the value from a cellFormater which checks the type in documentoIdentidad/tipo and get the value from shared documentoIdentidad/valor. When filtering, the criteria is over documentoIdentidad/valor, but we need to send documentoIdentidad/tipo = personalId, or documentoIdentidad/tipo = passport depending the field we search to filter all the values of IdentityDocument to mach personalIds or passports. Something like a handler "onFilter" over the listGridField or similar to manually add this criteria to the one passed to server

            Best regards and thanks for the tips

            Comment


              #7
              Hi hespresati,

              I'm still not sure about your use case. What do you mean by "to manually add this criteria to the one passed to server".

              Did you already see ListGridField.setFilterEditorProperties(FormItem filterEditorProperties) and FormItem.setCriterionGetter(FormItemCriterionGetter getter). You can use them in combination in order to get different criteria than the ones generated by default when you enter something into the ListGrid's FilterRow.

              Best regards,
              Blama

              Comment


                #8
                Thank you so much, Blama. That is what I am looking for. I didn't thought I could create an AdvancedCriteria in the ListGridField's FormItem

                Regards

                Comment


                  #9
                  There's a complete example of how to use this feature? Even reading the docs I don't understand very well how it works and which functions I have to override

                  Regards

                  Comment

                  Working...
                  X