cancel
Showing results for 
Search instead for 
Did you mean: 

Search function in sap.ui.table.treetable

01-16-2020 10:15 AM
1196 views 0 comments
SAP Managed Tags
Subscribe

Hello,

I am using sap.ui.table.treetable. Everything is working fine for me.

I am having some preselected value which i have to show as selected node. It is also working. I am having Search Button. While Search for the selected node, selected node data is showing but that selection is going disappear and the next node is showing as selected.

This is my code

var oTreeTable = this.getView().byId("treeTable");

var aIndices = oTreeTable.getSelectedIndices();

var filters = [];

var query = evt.getSource().getValue();

if (query && query.length > 0) {

var oFilter1 = [

new sap.ui.model.Filter("Title", sap.ui.model.FilterOperator.Contains, query),

new sap.ui.model.Filter("DiagnoseCode", sap.ui.model.FilterOperator.Contains, query)

];

var filter = new sap.ui.model.Filter(oFilter1, false);

filters.push(filter);

}

// update list binding

var list = this.getView().byId("treeTable");

var binding = list.getBinding("rows");

binding.filter(filters);

var Len = oTreeTable.getBinding("rows").getLength();

var l = 0;

var Len1 = aIndices.length;

for (l = 0; l <= Len1; l++) {

for (var h = 0; h <= Len; h++) {

if (h === aIndices[l]) {

oTreeTable.addSelectionInterval(h, h);

}

}

}

I have attached the SS of Without search function and with search function.

Without Search Function: which is correct.

With Search Function: Which is wrong.

Please someone help me to get the solution.

Thanks in advance.

Accepted Solutions (0)

Answers (0)