on 01-03-2015 6:35 AM
Hi,
Using a custome control in XML View is similar to use of Standard controls in XML Views . Here is short snippet to use :
Say, if you have a custom defined like this :
//This is a custom Input control which enables focusout event .
jQuery.sap.declare("customcontrols.CustomInput");
sap.m.Input.extend("customcontrols.CustomInput", { // inherit Input definition
metadata : {
events : {
"focusout" : {}
// new event definition focusout
}
},
// focus out event handler
onfocusout : function(evt) {
this.fireFocusout();
},
renderer : {}
// Standard renderer method is not overridden
});
//Include the namespace in the XML View and use the control. In this case, it is cc namespace
You can use this custom control like this in XML View :
Include the namespace in the XML View and use the control. In this case, it is cc namespace
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc"
xmlns:commons="sap.ui.commons" xmlns="sap.m" xmlns:layout="sap.ui.layout"
xmlns:cc="customcontrols" controllerName="ux3.Details" xmlns:html="http://www.w3.org/1999/xhtml">
<layout:VerticalLayout >
<cc:CustomInput id="creditAmount" width="100%">
</cc:CustomInput>
</layout:VerticalLayout>
Regards
Mayank Jain
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
I am trying to achieve this from xml view. From Dennis posted JSBin code, I am facing difficulty to converty below JS View code to XML View code. Please share how to use template scenario in XML View approach for below code.
var oCtrl = new CircularElementCollection({
elements: {
path: '/',
template: new CircularElement({
color: '{color}',
value: '{value}'
})
}
});
Regards,
Koti Reddy
I can't test it since I don't have access to JSBin right now, but let's say the custom controls are defined as :
com.business.app.custom.CircularElementCollection
com.business.app.custom.CircularElement
then in your XML view you define the namespace:
xmlns:cc="com.business.app.custom"
and you call the custom control in this way:
<cc:CircularElementCollection elements="{/}">
<cc:elements>
<cc:CircularElement color="{color}" value="{value}" />
</cc:elements>
</cc:CircularElementCollection>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dennis,
I used CSS Files as you mentioned as per JSBin but I got this kind of charts . Please share your recommendations to get circular chart.
I see two possibilities to get circular element.
1.Modifying CSS Class - I think below class gives circular element , so it may not need modification.
.CircularElement {
border-radius: 50%;
opacity: 0.7;
}
2. I see CSS Generation code in JS Bin which trigger circular element Map.Here how to pass border-radius to render it in cirular form.
function cssGenerator(css) {
return 'style="' + Object.getOwnPropertyNames(css).map(function(k) {
return k + ': ' + css[k];
}).join('; ') + '"';
}
oRm.write('<div');
oRm.writeControlData(oControl);
oRm.addClass('CircularElement');
oRm.writeClasses();
var r = oControl.getRadius();
var t = oControl.getThickness();
var c = oControl.getColor();
oRm.write(' ' + cssGenerator({
width: r,
height: r,
border: t + ' solid ' + c
}));
I got below type of elements as output.
Regards,
Koti Reddy
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
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.