Skip to Content
avatar image
Former Member

Filter OData SAPUI5

Hello!

I have one question. I would like to filter my table with this list. Can I do it? And how can I this filter make?

This is a photo what I mean. The value is "Abteilung".

I want to choose "Abteilung" from list and get only rows with this "Abteilung".

Thank you in advance for your help!

tablel.png

tablel.png (74.7 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Nov 22, 2016 at 04:21 PM

    Khristina,

    have you tried any code ? usually, you would get the table/list binding and then apply the filter to it.

    here is a similar example:

    https://sapui5.hana.ondemand.com/explored.html#/sample/sap.ui.table.sample.Filtering/preview

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 23, 2016 at 09:20 AM

    Yes, I have already a table. I have tried to make a search field. I have a connecton between OData and my table. In metadata file Data is searchable. That's why I don't understand why it doesn't work.

    Actually I want only to know how to make a connecton between this Filter List und my Table (please look on the photo below) ? I want that this list could be as Filter for my table

    Maybe you can give me also some advices about search field. It doesn't work..

    This is my code of filter...

      <EntityContainer Name="UI5UNI_SRV" m:IsDefaultEntityContainer="true">
                    <EntitySet
                        xmlns:sap="http://www.sap.com/Protocols/SAPData" Name="Sat50Collection" EntityType="UI5UNI_SRV.KernIppsat50" sap:searchable="true" sap:content-version="1"/>
                    </EntityContainer>
                    <atom:link
                        xmlns:atom="http://www.w3.org/2005/Atom" rel="self" href="./kernc/UI5UNI_SRV/$metadata"/>
                        <atom:link
    
    	onSearch : function (oEvt) {
     
    			// add filter for search
    			var aFilters = [];
    			var sQuery = oEvt.getSource().getValue();
    			if (sQuery && sQuery.length > 0) {
    				var filter = new Filter("ZzStat", sap.ui.model.FilterOperator.Contains, sQuery);
    				aFilters.push(filter);
    			}
     
    			// update list binding
    		
    			var list = this.getView().byId("idSatColl");
    			var binding = list.getBinding("items");
    			binding.filter(aFilters);
    		},
    
    
    
    Add comment
    10|10000 characters needed characters exceeded

  • Nov 23, 2016 at 10:29 AM

    What is the error message you get when executing onSearch in the console?
    Did you add the path sap.ui.model.Filter to the top of your controller file? Otherwise you have to change the Filter constructor to:

    var filter = new sap.ui.model.Filter("ZzStat", sap.ui.model.FilterOperator.Contains, sQuery);
    
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Daniel Degraf

      Hello again:)

      So, yes I set a breakpoint, actually nothing happend.

      If I begin to write a letter, this $batch begin also to react. it seems that requests only in backend happend...Maybe there are problem with OData.

      Batch request URL..

      Id of table should be right.

      	<Table id="idSatColl" items="{ path: '/Sat50Collection' }" mode="SingleSelectMaster" selectionChange="showvalue" inset="false" fixedLayout="false" class="sapUiSizeCompact">
      								<headerToolbar>
      									<Toolbar>
      										<ToolbarSpacer/>
      									<Button tooltip="Infobar" text="Infobar" icon="sap-icon://message-information" press="handleSideContentShow"/>	<Button tooltip="Gesamt" text="Gesamt" icon="sap-icon://overview-chart" press="getGesamtView"/><Button tooltip="Nutzungsgrad" text="Nutzungsgrad" icon="sap-icon://switch-views" press="getViewNutzungsgrad"/><Button tooltip="Verweildauer" text="Verweildauer" icon="sap-icon://detail-view" press="getViewVerweildauer"/><Button tooltip="View Settings" icon="sap-icon://settings" press="handleViewSettingsDialogButtonPressed"/>
      									</Toolbar>
      								</headerToolbar>
      								<columns>
      									<Column id="__column1" hAlign="Center" popinDisplay="Block" minScreenWidth="Tablet" demandPopin="true">
      										<header>
      											<Label text="Klinik" id="__label3"/>
      										</header>
      									</Column>
      									<Column id="__column2" hAlign="Center" popinDisplay="Block" minScreenWidth="Tablet" demandPopin="true">
      										<header>
      											<Label text="Abteilung" id="__label4"/>
      										</header>
      									</Column>
      									<Column id="__column3" hAlign="Center" popinDisplay="Inline" minScreenWidth="Tablet" demandPopin="true">
      										<header>
      											<Label text="Station" id="__label5"/>
      										</header>
      									</Column>
      									<Column id="__column4" visible="false" hAlign="Center" width="auto" popinDisplay="Block" minScreenWidth="Tablet" demandPopin="true">
      										<header>
      											<Label text="Afgbett.15" id="__label6"/>
      										</header>
      									</Column>
      									<Column id="__column5" visible="false" hAlign="Center" width="auto" popinDisplay="Block" minScreenWidth="Tablet" demandPopin="true">
      										<header>
      											<Label text="Afgbett.14" id="__label7"/>
      										</header>
      									</Column>
      									<Column id="__column6" visible="false" hAlign="Center" width="auto" popinDisplay="Block" minScreenWidth="Tablet" demandPopin="true">
      										<header>
      											<Label text="Afgbett.15" id="__label8"/>
      										</header>
      									</Column>
      									<Column id="__column7" hAlign="Center" visible="false" width="auto" popinDisplay="Block" minScreenWidth="Tablet" demandPopin="true">
      										<header width="auto">
      											<Label text="Afgbett.14" id="__label9"/>
      										</header>
      									</Column>
      									<Column id="__column8" hAlign="Center" popinDisplay="Block" minScreenWidth="Tablet" demandPopin="true">
      										<header>
      											<Label text="Beleg.15" id="__label10"/>
      										</header>
      									</Column>
      									<Column id="__column9" hAlign="Center" popinDisplay="Block" minScreenWidth="Tablet" demandPopin="true">
      										<header>
      											<Label text="Beleg.14" id="__label11"/>
      										</header>
      									</Column>
      
      sea1.png (190.1 kB)
      sea3.png (243.5 kB)
      sea4.png (218.9 kB)
      sea5.png (181.5 kB)
  • Nov 26, 2016 at 10:19 AM

    Hello,

    Please have a look at this Filters.

    Note: Please consider the first Combo Box.


    Thanks,

    Deepak Raj.

    ,

    Hello Khristina Filonchik,

    Please have a look at this filters

    hop u will get the required solution.

    Note:Please consider the first drop down


    Thanks,

    Deepak Raj.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 26, 2016 at 10:19 AM

    Hello,

    Please have a look at this Filters.

    Note: Please consider the first Combo Box.


    Thanks,

    Deepak Raj.

    Add comment
    10|10000 characters needed characters exceeded