-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtreeTable.js
84 lines (80 loc) · 3.5 KB
/
treeTable.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
onAfterRendering:function() {
//Add a filter to the table. Filtering will not work without this
this.getView().byId("treeTable").bindAggregation("rows", {path: "tableModel>/data",filters:[
new sap.ui.model.Filter("RequisitionNumber", sap.ui.model.FilterOperator.Contains, "")
]});
},
onPressExpandAll: function() {
this.getView().byId("treeTable").expandToLevel(25);
},
onPressCollapseAll:function(){
this.getView().byId("treeTable").collapseAll();
},
onSearchTable: function(oEvent) {
var sValue = oEvent.getParameters().query;
var oFilterRequisitionNumber = new sap.ui.model.Filter("RequisitionNumber", sap.ui.model.FilterOperator.Contains, sValue);
var oTableBinding = this.getView().byId("treeTable").getBinding("rows");
oTableBinding.filter(oFilterRequisitionNumber,"Application");
}
========================
<t:TreeTable
id="treeTable"
rows="{ path: 'tableModel>/data', parameters: {arrayNames:['items']}}"
selectionMode="Single"
enableSelectAll="false"
ariaLabelledBy="title"
class="sapUiLargeMarginTop"
>
<t:toolbar>
<!-- <Toolbar>
<Title id="title" text="Clothing"/>
<ToolbarSpacer/>
<Button text="Collapse all" press="onCollapseAll"/>
<Button text="Expand first level" press="onExpandFirstLevel"/>
</Toolbar>-->
</t:toolbar>
<t:columns>
<t:Column width="15%">
<Label text="Requisition #"/>
<t:template>
<Text text="{tableModel>RequisitionNumber}"/>
</t:template>
</t:Column>
<t:Column width="6%">
<Label text="Type"/>
<t:template>
<Text text="{tableModel>Type}"/>
</t:template>
</t:Column>
<t:Column width="10%">
<Label text="Requested Vendor"/>
<t:template>
<Text text="{tableModel>RequestedVendor}"/>
</t:template>
</t:Column>
<t:Column width="15%">
<Label text="Item Description"/>
<t:template>
<Text text="{tableModel>ItemDescription}"/>
</t:template>
</t:Column>
<t:Column width="4%">
<Label text="Qty"/>
<t:template>
<Text text="{tableModel>Qty}"/>
</t:template>
</t:Column>
<t:Column width="10%">
<Label text="Price/Value"/>
<t:template>
<Text text="{tableModel>PriceValue}"/>
</t:template>
</t:Column>
<t:Column width="10%">
<Label text="Needed by"/>
<t:template>
<Text text="{tableModel>NeededBy}"/>
</t:template>
</t:Column>
</t:columns>
</t:TreeTable>