4 Replies Latest reply on Feb 14, 2012 3:51 AM by green.kim.twsp RSS
    green.kim.twsp Explorer

    Data Filter Widget

    Hi Guys,
    When using the data filter widget is there anyway to limit the fields that are able to be chosen for filtering. As a data table has fields automatically created (source, location, key, etc) I think the end user will find them distracting if they are not in use. For instance do we need to have the location field as an optional search criteria when location is not being used at all.
    Regards, Kim

      • Data Filter Widget
        andyb Explorer

        At this time, the DataFilter widget can only work with the full set of parameters that are described in the DataShape of the service it's filtering for. You could create a new streamlined DataShape and associated service which uses it to eliminate the unwanted fields.

         

          • Data Filter Widget
            green.kim.twsp Explorer

            Andy, my DataShape only has 3 fields but when it's associated with the DataTable then I get all the DataTable fields as well. So are you telling me to create a new service in my DataTable Thing to query and return only the DataShape fields? Or are you telling me to create a whole new Thing that is not associated with a DataTable and add get and query services to that? Or am I completely off target?

             



              • Data Filter Widget
                andyb Explorer

                If you really need to 'hide' the extra (for free) fields in the UI then I would add a service to the DataTable itself, it's output being the original 'lean' DataShape. Then simply have a script handler like this:

                 

                var params = {

                infoTableName : "InfoTable",

                dataShapeName : "MyDataShape"

                };


                // CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(Undefined)

                var result = Resources['InfoTableFunctions'].CreateInfoTableFromDataShape(params);


                var params = {

                maxItems : 500

                };


                var dataTable = me.GetDataTableEntries(params);


                for each (row in dataTable.rows) {

                var data = new Object();


                data.field1 = row.field1;

                data.field2 = row.field2;

                //<etc>


                result.AddRow(data);

                }


                I suppose in your case you would use QueryDataTableEntries and pass in the query from your filter widget...but I'm sure you get the idea...