on 04-15-2019 11:54 PM
I have this table where I have a table inside a scroll container.
<core:FragmentDefinition xmlns="sap.m" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:core="sap.ui.core" xmlns:t="sap.ui.table" xmlns:l="sap.ui.layout"
controllerName="proj.controller.Area">
<Label text="Columns" width="100%" id="label1_1541454925956"/>
<Input xmlns="sap.m" value="Value" id="columnsInput" type="Number"/>
<Label text="Rows" width="100%" id="label0_1541454900545"/>
<Input xmlns="sap.m" value="Value" id="rowsInput" type="Number"/>
<ScrollContainer id="scrollContainer" horizontal="true" vertical="true">
<Table xmlns="sap.m" id="OTable"></Table>
</ScrollContainer>
</core:FragmentDefinition>
I want to populate this table through Javascript, similar to this code here: https://answers.sap.com/questions/345848/populate-grid-table-sapui5-dynamically.html.
However, I am having trouble connecting to the Javascript and populating.
/*eslint-disable no-console, no-alert */
sap.ui.define([
"sap/ui/core/mvc/Controller",
"sap/ui/core/Fragment"
], function (Controller, Fragment) {
return Controller.extend("[proj.controller.Area", {
onInit: function () {
var table = sap.ui.xmlfragment("proj.controller.Area", this);
table.populate();
},
populate: function (oEvent) {
//add code from link
}
});
});
Is this possible? Why is my fragment not reacting to the code?
table.populate(); ======>this.populate()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks! I changed it to this.populate(). However, i'm still finding that the function isn't being called. I've even added a simple alert("hello world") inside populate just in case it was my code that wasn't working but the alert doesn't pop up. Actually, now that I look at it, even why I inspect element and search for the Javascript file, I cannot find it. It seems like my Javascript file isn't properly attached somehow?
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.