Announcement

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

    Turn off AdvancedCriteria

    Hi,

    How do I turn off AdvancedCriteria?

    My back-end is PHP, so I want only simple values from my ListGrid filters and SearchForms.

    I tried changing editorType:"date" to "DateItem", but that didn't work. (I had read the default for date now is a date range, which triggers the AdvancedCriteria.)

    I looked for a property of the SearchForm, something like "useSimpleCriteria: true", but I didn't find anything.

    Thanks,
    Mike

    Code:
    isc.SearchForm.create({
        ID:"billingReportSearchForm",
            fields:[
                {name:"date_from", title:"From Date", editorType:"date"},
                {name:"date_to", title:"To Date", editorType:"date"},
                {name:"excel", title:"Excel", editorType:"checkbox"},
                {name:"report_name", title:"Report Name"}
            ]
        });

    SmartClient Version: SC_SNAPSHOT-2011-01-05/LGPL Deployment (built 2011-01-05)

    #2
    Hi,

    I figured it out. I needed to set type, not editorType, to "DateItem".

    Code:
    {name:"date_from", title:"From Date", type:"DateItem", useTextField:true},
    {name:"date_to", title:"To Date", type:"DateItem", useTextField:true}

    Mike

    Comment


      #3
      That's not correct - type should be a data type (eg "string" "date"). What you've really done is disable the automatic switchover to a DateRangeItem by telling the system that field is not of type "date".

      Instead, if you're trying to control the editor used in the ListGrid filterEditor, set filterEditorType:"DateItem".

      Comment


        #4
        Hi,

        Thanks. That works for ListGrid filters.

        But on a SearchForm, would I do it the way I described?

        Mike

        Comment


          #5
          No. On a SearchForm, editorType works.

          Comment


            #6
            I just tried it using the following form.

            The 2 date fields are still being treated as ranges. (so I get a total of 4 fields on the screen).

            I should note that these 2 fields do not exist in my datasource. I'm simply trying to send a start date and end date to my PHP on the backend, using simple parameters.



            Code:
            isc.SearchForm.create({
                ID:"submittedInvoiceSearchForm",
                    fields:[
                        {name:"date_from", title:"From Date", editorType:"DateItem"},
                        {name:"date_to", title:"To Date", editorType:"DateItem"}
                    ],
                    autoDraw:false
            });

            Comment


              #7
              Taking another tack, is there some system-wide setting I can adjust so that all date fields are treated as simple dates and not ranges?

              The problem is that when AdvancedCriteria are triggered by date ranges, my back-end PHP scripts all have to be adjusted. For the cases when there are multiple filters in effect, the data structure becomes too difficult to parse.

              (I'm trying to keep the PHP side fairly simple...I can make a handler for the AdvancedCriteria in PHP, but I'm under a deadline here...)

              Thanks,
              Mike

              Comment


                #8
                We've just made a change to avoid the issue whereby fields of type "date" in a search form show up as DateRangeItem even if there's an explicit editorType specified on the field. Now the editorType will be respected if specified.

                This will show up in the next nightly build

                Thanks
                Isomorphic Software

                Comment


                  #9
                  Sweet! That solves a major headache.

                  That's great the AdvancedCriteria exists as an option. As soon as I have some time to develop a PHP "reader" for that data structure, I will start to experiment with it.

                  Or maybe I can convince my boss to pay for the SmartClient server, so that I don't have to! Am I right in assuming a lot of that work is handled automagically by the server? (i.e. it generates the needed SQL WHERE clauses?)

                  Mike

                  Comment


                    #10
                    Yes. And also lets you customize the SQL without losing the automatic generation of the where clause.

                    Comment


                      #11
                      Oops those were SmartGWT examples. The equivalent SmartClient examples are here.

                      Comment


                        #12
                        Hi,

                        I am using the filter on a ListGrid.

                        In the new version 8, the "params" is more complicated than I need. Is there a way to make it just a simple params option like it was in version 6.5?

                        See JSON request below.

                        I'd like params to just be the name/value pairs, without the operator/criteria additions.

                        Thanks.

                        Code:
                        {
                            "actionURL":"/gbs/data/restDS.php", 
                            "showPrompt":true, 
                            "prompt":"Finding records that match your criteria...", 
                            "transport":"xmlHttpRequest", 
                            "useSimpleHttp":true, 
                            "promptStyle":"dialog", 
                            "params":{
                                "operator":"and", 
                                "criteria":[
                                    {
                                        "fieldName":"contract_name", 
                                        "operator":"iContains", 
                                        "value":"ABC"
                                    }
                                ], 
                                "isc_metaDataPrefix":"_", 
                                "isc_dataFormat":"json"
                            }, 
                            "httpMethod":"GET", 
                            "sendNoQueue":true, 
                            "bypassCache":true, 
                            "callback":{
                                "target":[GbsRestDataSource ID:contractRestDS]
                            }, 
                            "willHandleError":true, 
                            "serverOutputAsString":true, 
                            "clientContext":{
                                "requestIndex":2
                            }, 
                            "data":null
                        }

                        SmartClient Version: SC_SNAPSHOT-2011-01-06/LGPL Deployment (built 2011-01-06)

                        Comment


                          #13
                          Similar issue here. Just updated from SmartClient 6.5 to 8.0 and now LOTS of things don't work as simple criteria is being represented as AdvancedCriteria which the server-side PHP is not setup to handle.

                          1. What triggers the switch to using the AdvancedCriteria format?
                          2. Is there a way to TURN THIS "FEATURE" OFF?

                          Comment


                            #14
                            DataSource.willHandleAdvancedCriteria.

                            Comment

                            Working...
                            X