Forums

Home » Alloy UI » English

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Mk Sin
Pre-set color to AUI colorpicker
May 30, 2012 8:58 PM
Answer

Mk Sin

Rank: Junior Member

Posts: 74

Join Date: May 25, 2012

Recent Posts

http://www.liferay.com/community/liferay-projects/alloy-ui/demo?title=community-liferay-projects-alloy-ui-demos-color-picker
Following that link, i know how to use colorpicker, and it work fine, but...
I dont know how to pre-set color in the picker( when click on the picker, colorpicker popup open with no color preset, the next times it will open with lastest color you picked)
Anybody can help me plz emoticon
Yaroslav Rudyy
RE: Pre-set color to AUI colorpicker
July 7, 2012 11:33 AM
Answer

Yaroslav Rudyy

Rank: New Member

Posts: 2

Join Date: March 2, 2011

Recent Posts

Mk Sin:
http://www.liferay.com/community/liferay-projects/alloy-ui/demo?title=community-liferay-projects-alloy-ui-demos-color-picker
Following that link, i know how to use colorpicker, and it work fine, but...
I dont know how to pre-set color in the picker( when click on the picker, colorpicker popup open with no color preset, the next times it will open with lastest color you picked)
Anybody can help me plz emoticon



<aui:script use="aui-color-picker">
AUI().ready('aui-color-picker-base', function(A) {
var colorNode = A.one('#color');
window.colorPicker = new A.ColorPicker({
hex: colorNode.text(),
after: {
colorChange: function(val) {
var hex = '#' + this.get('hex');
colorNode.setContent('color: ' + hex);
colorNode.setStyle('backgroundColor', hex);
}
}
}).render('#demo');
});
</aui:script>