I'm trying to insert css in my google-chart table.
My code
var cssClassNames = {'headerRow': 'cssHeaderRow',
'tableRow': 'cssTableRow',
'oddTableRow': 'cssOddTableRow',
'selectedTableRow': 'cssSelectedTableRow',
'hoverTableRow': 'cssHoverTableRow',
'headerCell': 'cssHeaderCell',
'tableCell': 'cssTableCell',
'rowNumberCell': 'cssRowNumberCell'
};
var options = {page: 'enable', pageSize:20, height:'100%',
sort:'enable', showRowNumber: true, width: '100%',
showRowNumber: true,
alternatingRowStyle:true, allowHtml: true,
cssClassNames: cssClassNames}
this.$.chart_class.options = options;
But it's not working.
I have added
this.$.chart_class.set('options', options);
and
this.$.chart_class.redraw();
I need to style the pagination too.
Please provide full code and what exactly you need but if you have already chart exist and you need styling of chart then you may use element's styling :
<template>
<style>
google-chart {
height: 300px;
width: 50em;
......
}
.....
</style>
<google-chart
type="{{type}}"
options="{{options}}"
cols="{{cols}}"
rows="{{rows}}">
</google-chart>
In case if you need to specify google-chart property dynamically than specify cols and rows, besides your options are not formatted as into element description. But simply you may use and define properties dynamically:
At the property declaration, you may define this properties and options. Or in a function with the button or somehow with calling this function:
defininingChartVariables(){
var type = "pie" // See the possible types below link.
var cols = [<specify an array for cols>];
var rows = [<specify an array for rows>];
var options = {title: "Chart title goes here",
hAxis: {title: "Categories"},
vAxis: {title: "Values", minValue: 0, maxValue: 2},
legend: "none" };
this.set('type',type);
this.set('cols',cols);
this.set('rows',rows);
this.set('optiosn',options);
}
see the possible types
Related
I am trying to figure out how to dynamically change a size of ngDialog that I use for my popups. The dialog fires event when it's been opened:
$scope.$on('ngDialog.opened', function (e, $dialog) {
dialogReady($dialog);
});
I tried all of these:
function dialogReady(caseEditorWindow) {
caseEditorWindow.css({ 'width' : '1350px' });
caseEditorWindow.width(1350);
caseEditorWindow.css('width', '1350px' });
}
Nothing takes any effect.
It only gets sized if I use a class like this:
<style>
.ngdialog.dialogcaseeditor .ngdialog-content
{
width : 1350px;
height: 810px;
margin-top:-100px;
padding-top:10px;
}
</style>
at the time of creating the dialog:
ngDialog.open({
template: 'caseEditor.html',
controller: 'caseEditorController',
className: 'ngdialog-theme-default dialogcaseeditor',
closeByDocument: false,
disableAnimation: true,
scope: $scope
data: row
})
Any idea?
Thanks
var dialog = ngDialog.open(); //always return object {id: 'div attr id'};
$('#'+ dialog.id).css('width', '100px'); //You can get outer div like this
Althrough, not so good using jquery in angular controller, but it works (the only way).
I'm using TinyMCE 4. Unfortunately the "backcolor" control seems to only allow changes to text, not a whole paragraph. Even when I select a paragraph in the status bar of TinyMCE and apply a background color, it's only applied to the inner span, not the paragraph itself. I would need to set the background color for the complete content, not only parts of it. This should be applied to the HTML output, something like
<div style="background-color: #f00">[complete editor content]</div>
Thanks for any help.
You can use this code to access the tinymce's body to set background color:
tinymce.activeEditor.getBody().style.backgroundColor = '#<yourcolor>';
Disadvantage: Setting the background color that way will not change/affect the html content inside the editor. So you have to treat/update/store that value in a separate way.
You can also add a button on initialising tinymce:
tinymce.init({
...
setup: function (editor) {
editor.addButton('mybutton', {
text: 'Set bgColor',
icon: false,
onclick: function () {
editor.getBody().style.backgroundColor = '#E5FFCC';
}
});
...
});
You have to reach the editable content body in the dynamically generated iframe. The iframe is generated after the initialization of the editor.
If your textarea id is foo, the id of the iframe is foo_ifr.
You may also open the editor with firebug or developer tools and use dom explorer, you may see the inner dynamically generated components.
use:
var iframe = document.getElementsByTagName("iframe")[0];
// or
var iframe = document.getElementsById("foo_ifr");
// check if iframe.contentDocument is cross-browser, i tested with IE 11.
var innerBody = iframe.contentDocument.getElementsByClassName("mceContentBody")[0];
innerBody.style.backgroundColor="red";
To get the custom styling that you want, you have to create new custom style formats when the editor is being initialized. This gives you the ability to define css styling to the element. For example
HTML
<form>
<textarea></textarea>
</form>
JS
tinymce.init({
selector: 'textarea',
//merge with default formats
style_formats_merge: true,
//set up custom style formats
style_formats: [
{title: 'Red Background', block: 'p', styles: {
'background-color': '#ff0000',
'color':'white',
'padding': '7px'}
},
{title: 'Blue Background', block: 'p', styles: {
'background-color': '#0000ff',
'color':'white',
'padding': '7px'}
}
]
});
This merges two new custom formats with the default formats. See this DEMO
I have the following sidebar in my extension but I want change the look and feel. How can I do this?
var sidebar = new appAPI.sidebar({
position: 'right',
url: 'http://news.yahoo.com',
html: 'Some Html',
title: {
content: 'Yahoo News',
close: true
},
opacity: 1.0,
width: '300px',
height: '100%',
preloader: true,
sticky: true,
slide: 150,
openAction: ['click', 'dblclick'],
closeAction: 'click',
theme: 'default',
scrollbars: false,
openOnInstall: true
There are several ways to do achieve this but my preferred method is to inject the relevant CSS rules into the page using the appropriate selector. So, for example, to change the border color to red:
var inlineCss = '.crossrider-sidebar-'+appAPI.appInfo.id+'-container {' +
'border-color:red !important;' +
'}';
appAPI.dom.addInlineCSS({css:inlineCss});
[Disclosure: I am a Crossrider employee]
I'm wondering if it's possible to add custom formatting to redactor? I created a custom button, and I'm able to change the formatting of text, but only using certain elements:
['p', 'blockquote', 'pre', 'h3', 'h4', 'h5']
However, I'm not able to add any of the following:
['small', 'figcaption']
I followed the Redactor docs to set up the button, and here is my function that is being called:
var selected_html = $('#redactor_content').getSelected();
$('#redactor_content').execCommand('formatblock', '<small>');
I also tried adding elements to my 'formattingTags' array, but it didn't seem to have any affect.
formattingTags: ['p', 'blockquote', 'small', 'pre', 'h3', 'h4']
Thank you in advance.
I think I figured it out.
I added the following to my button function:
var $selected_html = $('#redactor_content').getSelected();
$('#redactor_content').execCommand('inserthtml', '<small>' + $selected_html + '</small>');
However, this is not perfect as it does not replace the parent tag, and you can keep adding elements within elements.
Something like that:
redactorOptionsDefaults = {
buttonsAdd: {},
activeButtonsAdd: {},
buttonsCustom: {}
};
redactorOptionsDefaults.buttonsCustom.small = {
title: 'small Header',
callback: function () {
this.formatBlocks('small');
}
}
redactorOptionsDefaults.activeButtonsAdd.small = 'small';
It formatting block, highlight button if needed while selecting block. But don't remove style while repeat button click
I have the following code, which generates a basic layout for my app:
tabpanel = new Ext.TabPanel({
fullscreen: false,
ui : 'dark',
sortable : false,
tabBarDock: 'bottom',
cardSwitchAnimation: 'flip',
items: [{
title: 'Tab 1',
html : '1',
cls : 'card1',
icon : 'tab1'
}]
});
lists.views.Viewport = Ext.extend(Ext.Panel,{
fullscreen: true,
layout: 'fit',
dockedItems: [{
xtype: 'toolbar',
dock: "top",
title: 'title'
}],
items: [tabpanel],
initComponent: function() {
this.tabpanel.add(new lists.views.ItemLists());
lists.views.Viewport.superclass.initComponent.apply(this, arguments);
},
});
This doesn't work, probably due to the fact that the TabPanel that is inside the Viewport Panel cannot be pointed to like this. I've searched through the sencha documentation but I can't find how to add the
new lists.views.ItemLists()
to the tabpanel, which in turn is inside the
lists.views.Viewport
Also, there will be other stuff I want to declare before my viewport (or even after it) that I want to add to specific other panels I might add later. What is the best way to achieve this?
Any ideas on how to do this?
Thanks!
If you take the this. off the reference to the tabpanel in the Viewport's initComponent method then it should work because the tabpanel variable is global.
Alternatively, you can access the Viewport's items via the items property, for example,
initComponent: function(){
this.items.get(0).add(new lists.views.ItemLists());
lists.views.Viewport.superclass.initComponent.apply(this, arguments);
}
Hope this helps
Stuart