on 10-28-2015 10:29 AM
Hi,
I have derived from sap.m.input to make the "Press enter key" available as public event:
sap.ui.define([ "sap/m/Input" ], function(Input) {
"use strict";
/**
* This derivation of sap.m.Input is used to make the internal onsapenter event available in the public interface so
* that e.g. a search can be triggered by the application when the users hits enter in one of the search form input
* controls
*/
var InputEx = sap.m.Input.extend('myapp.util.controls.InputEx', {
metadata : {
properties : {},
aggregations : {},
events : {
enter : {
parameters : {}
}
}
},
renderer : {},
});
InputEx.prototype.onsapenter = function() {
if (Input.prototype.onsapenter) {
// Call the base class implementation!!!
Input.prototype.onsapenter.apply(this, arguments);
}
this.fireEnter();
};
return InputEx;
});
In one place of my XML view I have replaced the sap.m.input with my InputEx control now:
<ex:InputEx
id="Inp-Equnr"
type="Number"
enter="onEnterInputEqui">
<layoutData>
<layout:GridData span="L2 M2 S4" />
</layoutData>
</ex:InputEx>
These are the namespace declarations in my view:
<mvc:View
controllerName="myapp.controller.Masterdata"
xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc"
xmlns:layout="sap.ui.layout"
xmlns:form="sap.ui.layout.form"
xmlns:ex="myapp.util.controls"
xmlns="sap.m">
After doing this change from sap.m.input to my InputEx I get the following error message in the console when loading the view:
Uncaught Error: failed to load 'sap/m/layoutData.js' from resources/sap/m/layoutData.js: 404 - Not Found
Is there anything I have forgotten in the implementation of my derived control?
Why can't I use layoutData like I used it before?
Meanwhile I found the solution - also on SCN:
https://scn.sap.com/thread/3650322
I have to use the same namespace for the layoutData as with the custom control:
<ex:InputEx
id="Inp-Equnr"
type="Number"
enter="onEnterInputEqui">
<ex:layoutData>
<layout:GridData span="L2 M2 S4" />
</ex:layoutData>
</ex:InputEx>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Frank,
Will this helpful? http://plnkr.co/edit/lfuJBNRTCcGQnzEmefTG?p=preview
http://plnkr.co/edit/lfuJBNRTCcGQnzEmefTG?p=preview
Thanks,
Karthik A
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
24 | |
11 | |
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.