Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how to use filter in a table using Odata service!!

Hi Experts

     I am using using Odata service in a table and i want to get filtered data in table using odata service.

but it is not working .  Please help me out.

Please also check the code below:


     var openTable = new sap.m.Table({

       id: "openTable" ,

       columns: [

       new sap.m.Column({

       width: "20%",

       header: new sap.m.Label({

       text: "Description" 

        })

       }),

       new sap.m.Column({

       width: "20%",

       header: new sap.m.Label({

       text: "Order Quantity"

        })

       }),

       new sap.m.Column({

       width: "20%",

       header: new sap.m.Label({

       text: "Price"

       })

       }),

      

       new sap.m.Column({ 

       width: "20%",

       header: new sap.m.Label({

       text: "Net Amount"

       })

       }),

       new sap.m.Column({ 

           width: "20%",

           header: new sap.m.Label({

           text: "Status Summary"

           })

           }),

           new sap.m.Column({ 

               width: "20%",

               header: new sap.m.Label({

               text: "Shipped"

               })

               }),

         ]

       });

    

     debugger;

     var    templ = new sap.m.ColumnListItem({

    id: "ite",

        type: "Navigation",

        visible: true,

        cells: [

             

               new sap.m.Label({

               text: "Description",

               design : "Bold"

                 }),

               new sap.m.Label({

               text: "{Ordered}"

               }),

               new sap.m.Label({

               text: "{Price}"

                    }),

               new sap.m.Label({

               text: "{Amount}"

                

               }),

               new sap.m.Text().bindProperty("text","StatusSummery",function(id){

                  

                   if(id == "Shipped")

                    {

                    this.addStyleClass("green");

                      }

                          else if(id=="Open"){

                    this.addStyleClass("red");

                    }

                    else if(id == "In Process")

                    {

                    this.addStyleClass("yellow");

                  

                    }

                    return id;

                    }

                     ),                   

                   

                   

           new sap.m.Label({

           text: "{Shipped}"

           }),

           ]

              

    

     });

     debugger;

     var f1 = new  sap.ui.model.odata.Filter('StatusSummery', sap.ui.model.FilterOperator.EQ, "Open"); 

     openTable.bindAggregation("items","/data2",templ,f1 );

Former Member
replied

Hi Vishnu,

Try like this and check:

var f1 = new  sap.ui.model.Filter('StatusSummery', "EQ" , "Open");

openTable.bindAggregation("items",{path:"/data2", template:templ, filters:f1});

Also check the spelling, I guess it should be "StatusSummary"


Regards,

Sai Vellanki.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question