on 08-05-2022 12:25 PM
Hi Experts,
I am trying to create an individual search for each column in my sap.m.table. I had tried the same thing in the grid table by enable cell filter however the grid table doesn't satisfy my need to certain level and also some functions. So can anyone please guide me how to enable each column search in the m library table.
Regards
Raman Nanda
try this. may be fulfil your requirement.
sap.ui.define([
"sap/ui/core/mvc/Controller",
'sap/ui/model/json/JSONModel',
],
function (Controller, JSONModel) {
"use strict";
return Controller.extend("project1.controller.View1", {
onInit: function () {
var oTable = this.getView().byId("idProductsTable");
var that=this;
oTable.addEventDelegate({
onAfterRendering: function() {
var oHeader = this.$().find('.sapMListTblHeaderCell');
for (var i = 0; i < oHeader.length; i++) {
var oID = oHeader[i].id; that.onClick(oID);
}
} }, oTable);
},
onClick: function(oID) {
var that = this;
$('#' + oID).click(function(oEvent) {
var oTarget = oEvent.currentTarget;
var oLabelText = oTarget.childNodes[0].textContent;
var oIndex = oTarget.id.slice(-1);
var oView = that.getView();
var oTable = oView.byId("idProductsTable");
var oResponsivePopover = that.getView().byId("helloResponsivePopover");
oResponsivePopover.openBy(oTarget);
});
}
});
});
<mvc:View controllerName="project1.controller.View1" xmlns:mvc="sap.ui.core.mvc" xmlns:core="sap.ui.core" xmlns="sap.m">
<Page id="page" title="{i18n>title}">
<Table id="idProductsTable" >
<columns> <Column>
<Text text="Product" />
</Column> <Column>
<Text text="Supplier" />
</Column> <Column>
<Text text="Dimensions" />
</Column> <Column>
<Text text="Weight" />
</Column> <Column>
<Text text="Price" />
</Column> </columns>
<items>
<ColumnListItem >
<cells>
<Text text="{}" />
<Text text="{}" />
<Text text="{}" />
<Text text="{}" />
<Text text="{}" />
<Text text="{}" />
</cells>
</ColumnListItem>
</items>
</Table>
<ResponsivePopover id="helloResponsivePopover" placement= "cells" afterOpen= "onOpen">
<content>
<List>
<items>
<CustomListItem type="Active" press="onAscending">
<Label text="Sort Ascending" /> </CustomListItem>
<CustomListItem type="Active" press="onDescending">
<Label text="Sort Descending" />
</CustomListItem>
</items> </List>
</content>
</ResponsivePopover>
</Page>
</mvc:View>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.