Skip to Content

Get rendered table after applying filter on sap.ui.table

Jan 11, 2017 at 10:45 PM


avatar image

Hi community,

Is there some event triggered after applying a filter on the sap.ui.table where I can see all new filtered items?

My objective is to make specific cells of the table non-editable, after the filtering function and rerendering of the table. Here's my code (this function is called from a checkbox in the view):

applyFilter: function(oEvent){
this._theFilter = new Filter([caseFilter, oFilter], true);
this._oTable.getBinding("rows").filter(this._theFilter, "Application");

I can't get the table in onAfterRendering() function because it never goes there after the filtering... I also tried adding the filter function in sap.ui.table element but it also doesn't go there. I have tried adding .getBinding("rows").attachChange() function but there I can only see the aIndices[] where it shows which items from the model are filtered, but I don't get the table...

Do you have any suggestion how I can get the filtered table? (Keep in mind - the filtering works, I just don't know how to get the table in the code after it's filtered)



10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Sai Vellanki Jan 12, 2017 at 04:25 AM

Hello Sashko,

Please try something like below:

   var oTable2 = sap.ui.getCore().byId("oTable");    //Get hold of Table
   oTable2.addEventDelegate({                        //Table onAfterRendering event
      onAfterRendering: function() {                 
        var oBinding = this.getBinding("rows");      //Get hold of binding aggregation "row"
        oBinding.attachChange(function(oEvent) {     //Attach 'binding' change event which fires on filter / sort
          var oSource = oEvent.getSource();
          var oLength = oSource.getLength();
          alert("Filtered Length: " + oLength);
    }, oTable2);

Here is a sample: Table afterFilter event

It might fire two times, but I hope you can work on it ;-)

Have a Nice Day!

Best Regards,


Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Sai,

Yes, as I said I've already tried attachChange(), but that doesn't work for me because I need to get the actual rerendered table element not the event. I know that in this oSource I can see the new records that will be added to the table, but what I need is the new table not just the new records from the model which will be in the table.

And I need the new rendered table so that I can get the id of the cell which I want to make non-editable.

Is there a way to get the table inside attachChange with the same number of records as I get from oSource.getLength() ? I don't think so...


Hi Sashko Janev ,

Actually sai is correct from oSource you can get the table. Now if you want to make the specific rows editable don't use IDs for that use model and binding way to make the field editable and uneditable ..



Sashko Janev Jan 15, 2017 at 09:40 PM

Is there someone else with a suggestion on this matter?

10 |10000 characters needed characters left characters exceeded