Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sap.ui.define([
- "sap/ui/core/mvc/Controller",
- "sap/ui/model/Filter",
- "sap/ui/core/Fragment",
- "com/employeeDb/model/formatter"
- ], function(Controller, Filter, Fragment, formatter) {
- "use strict";
- return Controller.extend("com.employeeDb.controller.Default", {
- formatter:formatter,
- onSearch: function(oEvent) {
- var aFilters = [];
- var sQuery = oEvent.getSource().getValue();
- if (sQuery && sQuery.length > 0) {
- var filter = new Filter("emplLName", sap.ui.model.FilterOperator.Contains, sQuery);
- aFilters.push(filter);
- }
- var oList = this.byId("idEmployeeTable");
- var oBinding = oList.getBinding("items");
- oBinding.filter(aFilters, "Application");
- },
- onCloseDialog: function() {
- this.byId("idDetailedEmployeeInfo").close();
- },
- onOpenDialog: function(oEvent) {
- var oView = this.getView();
- var oSelectedItem = oEvent.getSource();
- var oContext = oSelectedItem.getBindingContext("employee");
- var sPath = oContext.getPath();
- var oDialog2 = this.byId("idDetailedEmployeeInfo");
- if (!oDialog2) {
- Fragment.load({
- id: oView.getId(),
- name: "com.employeeDb.fragments.DetailedEmployeeInfo",
- controller: this
- }).then(function(oDialog) {
- oView.addDependent(oDialog);
- oDialog.bindElement({
- path: sPath,
- model: "employee"
- });
- oDialog.open();
- });
- } else {
- oDialog2.bindElement({
- path: sPath,
- model: "employee"
- });
- oDialog2.open();
- }
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement