Angular UI-grid header cell icon swap - angular-ui-grid

I am building a grid using angular ui-grid. The column headers have a downward chevron like so:
I would very much like to change that icon to something else. Is there a simple way to do this without having to go through the headache of creating a custom headerCellTemplate?

In the end I went another way. We added a template overtop of the existing icon as it seemed better than changing the code native to ui grid
.ui-grid-column-menu-button i{
color: white;
background: url("data:image/svg+xml;utf8,<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' width='7.91px' height='13.412px' viewBox='0 0 7.91 13.412' enable-background='new 0 0 7.91 13.412' xml:space='preserve'><polyline fill='none' stroke='#FFFFFF' stroke-miterlimit='10' points='-690,-124 -697,-117 -703.969,-123.938 '/><polyline fill='none' stroke='#FFFFFF' stroke-miterlimit='10' points='-704.406,-134 -697.406,-141 -690.438,-134.062 '/><polygon fill='#FFFFFF' points='4.058,13.412 0.22,9.592 0.925,8.883 4.056,12 7.203,8.854 7.91,9.561 '/><polygon fill='#FFFFFF' points='0.707,4.56 0,3.853 3.853,0 7.69,3.821 6.985,4.53 3.854,1.413 '/></svg>");
background-position: 50% 85%;
background-repeat: no-repeat;
width: 100%;
}

Yup.
Not that this advised due to the nature of this change, but you can change the class that is responsible for appending that icon in the ui-grid.js file:
Search for ui-grid-icon-angle-down in ui-grid.js
It will appear in the following line :
"<div role=\"columnheader\" ng-class=\"{ 'sortable': sortable }\" ui-grid-one-bind-aria-labelledby-grid=\"col.uid + '-header-text ' + col.uid + '-sortdir-text'\" aria-sort=\"{{col.sort.direction == asc ? 'ascending' : ( col.sort.direction == desc ? 'descending' : (!col.sort.direction ? 'none' : 'other'))}}\"><div role=\"button\" tabindex=\"0\" class=\"ui-grid-cell-contents ui-grid-header-cell-primary-focus\" col-index=\"renderIndex\" title=\"TOOLTIP\"><span class=\"ui-grid-header-cell-label\" ui-grid-one-bind-id-grid=\"col.uid + '-header-text'\">{{ col.displayName CUSTOM_FILTERS }}</span> <span ui-grid-one-bind-id-grid=\"col.uid + '-sortdir-text'\" ui-grid-visible=\"col.sort.direction\" aria-label=\"{{getSortDirectionAriaLabel()}}\"><i ng-class=\"{ 'ui-grid-icon-up-dir': col.sort.direction == asc, 'ui-grid-icon-down-dir': col.sort.direction == desc, 'ui-grid-icon-blank': !col.sort.direction }\" title=\"{{isSortPriorityVisible() ? i18n.headerCell.priority + ' ' + ( col.sort.priority + 1 ) : null}}\" aria-hidden=\"true\"></i> <sub ui-grid-visible=\"isSortPriorityVisible()\" class=\"ui-grid-sort-priority-number\">{{col.sort.priority + 1}}</sub></span></div><div role=\"button\" tabindex=\"0\" ui-grid-one-bind-id-grid=\"col.uid + '-menu-button'\" class=\"ui-grid-column-menu-button\" ng-if=\"grid.options.enableColumnMenus && !col.isRowHeader && col.colDef.enableColumnMenu !== false\" ng-click=\"toggleMenu($event)\" ng-class=\"{'ui-grid-column-menu-button-last-col': isLastCol}\" ui-grid-one-bind-aria-label=\"i18n.headerCell.aria.columnMenuButtonLabel\" aria-haspopup=\"true\"><i class=\"ui-grid-icon-angle-down\" aria-hidden=\"true\"> </i></div><div ui-grid-filter></div></div>"
Change ui-grid-icon-angle-down to something else, perhaps a different font-awesome class (I'll use fa fa-cogs)

Related

Highcharts - Adding css to highcharts legend

I am attempting to customize my Highcharts legend to html with in line style tag in order to change the color using this.color
I am using
labelFormatter: function () {
return "Total amount of <b style='" + this.color + ">" + this.name + " Percentage"
}
in attempt to accomplish this. I would like the legend of graph to display "Total amount of LOW Percentage" I am able to accomplish this but I am now trying to add styling to "LOW", "MEDIUM" or "HIGH" which is coming from this.name; I would like to make that color the same color that it is in the graph such as :
LOW = Green,
MEDIUM = Orange
HIGH = RED
I attempted to accomplish this by using this.color but it did not have any affect on my legend.
Here is a jsfiddle with my code: https://jsfiddle.net/uyr2tb7n/3/
The returned string should look like this:
legend: {
...,
labelFormatter: function() {
return "Total amount of <span style='color:" + this.color + "'>" + this.name + "</span> Percentage"
}
}
Live demo: https://jsfiddle.net/BlackLabel/jv3p5z8t/
API Reference: https://api.highcharts.com/highcharts/legend.labelFormatter

How to customize the volusion store and integrate a "get a quote" option

I want to customize the store and have an option for the users to get a quote for the products, once clicked on the option it will send mail to admin of store about the same along with the product ID
Let me know how can this be achieved ?
I did something similar ... added a Make Offer button for any product over X amount of money. Here's what my code in the template.html looks like...
var price = $("span[itemprop='price']").html();
if ( price != null && price != 'undefined' ) {
price = price.replace("$", "");
price = price.replace(",", "");
var pname= $("span[itemprop='name']").html();
pname= pname.replace(/\W+/g, "_")
var pcode = $('.product_code').html();
if ( price > 50 )
{
$('.vCSS_input_addtocart').after('<p><input type="button" style=" text-shadow: -1px -1px 0 #006d72, 1px -1px 0 #006d72, -1px 1px 0 #006d72, 1px 1px 0 #006d72;border-radius: 6px; border: 1px solid #6E2B62; background-color:#009DA5; color:white" value="Make An Offer" onclick="window.open( \'/v/vspfiles/makeanoffer.asp?ProductCode='+pcode+'&price='+price+'&pname='+pname+' \',\'_blank\', \'width=300px, height=500px\' ) " />');
Then I have a custom ASP page that handles the email, which is another can of worms. You could more easily use the built-in email form, which is explained here...
https://support.volusion.com/hc/en-us/articles/209448057-How-to-Create-a-Storefront-Email-Contact-Form
Good luck!

How to format the tooltip content in nvd3-angularjs

Im using Stacked area chart of nvd3-angularjs
This is my html
<div ng-controller="Eth2GraphController">
<nvd3-stacked-area-chart
data="GraphData"
noData="No Data For You!"
id="eth2Graphs"
showXAxis="true"
showYAxis="true"
showLegend="true"
interactive="true"
tooltips="true"
objectEquality="true"
margin="{left:100,right:100}"
useInteractiveGuideline="true"
tooltipcontent="toolTipContentFunction()"
xAxisTickFormat="xAxisTickFormatFunction()"
yAxisTickFormat="yAxisTickFormatFunction()"
color="colorFunction()"
legendColor="colorFunction()"
>
<svg></svg>
</nvd3-stacked-area-chart>
</div>
Now, I have a function that should format the tooltipcontent, but its not working. Maybe it has something to do with the useInteractiveGuideline attribute. I used the same tooltipcontent function to edit the tooltip of my other charts, its working on those charts the only difference is that those chart dont use useInteractiveGuideline.
$scope.toolTipContentFunction = function() {
return function(key, x, y, e, graph) {
return '<h3>' + x + '</h3>' +
'<p>' + key + ' ' + y + '</p>';
}
};
I want x to be in the center, and other formatting for the data. How would I do that? Am I using the correct attribute that would format the tooltip?
Change tooltipcontent="toolTipContentFunction()" to:
tooltipContent="toolTipContentFunction"
useInteractiveGuideline must be set to false for the tooltipContent to work. I believe it is because useInteractiveGuideline uses it's own popup.

Display a button based on the value of the column kendo grid

i have column named type and its an enum
public enum CalcEnum
{
Created = 0,
Calculated = 1,
Imported = 2,
Edited = 3
}
I want to display a button based on the value of this field. Say if the value is created then i want to show a button in the grid. I have tried like this but its not working
#(Html.Kendo().Grid(Model.values)
.Name("Grid1")
.Columns(columns =>
{
columns.Bound(p => p.UserComments).Title("Comments");
columns.Bound(p => p.Type).Title("Type");
columns.Template(#<text></text>)
.ClientTemplate("#if(Type == '0') {#"
+ "View"
+ "#} else {#"
+ "Open"
+ "#} #").Title(string.Empty);
}
Any clues where im doing wrong ? Thanks
Here is a link to the templates overview.
Here is a similar question where an external function is called to do all the processing.
Here is a similar question to yours.
I am also not too sure why you have quotes on your 0.
I have performed the action client side and if you do this I believe you need to put 'data.' before your Model's property.
`#if(data.Type == 0)`
Try that OR check the links below to see the links to questions similar to yours.
I can't set up a project to test this at the moment but I can give you a quick look at how I have used it with a boolean (CanCanel).
columns.Template(#<text></text>).ClientTemplate(
"<button type='button' class='myRequestsViewRequest grid-btn grid-btn-primary' style='margin: 3px 15px 3px 0;'" +
"data-requestid='#= RequestId #' data-requesterdisplayname='#= RequesterDisplayName #'>View</button>" +
" #if (!(data.CanCancel)) " +
"{# <span class='grid-btn grid-btn-disabled'>Cancel</span> #} " +
"else {# <a class='grid-btn grid-btn-primary' href='" +
Url.Action("CancelRequest", "Home") +
"?requestId=#= RequestId #' " +
" onclick='return MyRequest_ConfirmCancel()'>Cancel</a> #}#")
.Title("Actions")
.Width(200);
})
What if you change the column value 'Type' in the condition as below
if(#=Type# == '0')

smaller & nicer select with bootstrap.css

Of course I know that SELECT form elements are hard to style and/or modify beyond the basics.
Just out of curiosity, does anyone know of a one-off bootstrap (the one from twitter) solution that would allow me to affect the size of the SELECT and perhaps even apply a gradient that looks more like a bootstrap button (than the scratchy surface they have now).
I don't mind noodling around with the CSS myself, but I thought I'd ask around before re-inventing the wheel.
Any pointers, links or suggestions would be greatly appreciated.
You can use the jQuery plugin bootstrap-select:
https://developer.snapappointments.com/bootstrap-select/
It will turn your select into a bootstrap button dropdown
A bit late but maybe this can help http://blog.iamjamoy.com/docs/select.html
or this http://ivaynberg.github.com/select2/
The first one doesn´t work on IE, if you can fix it please provide.
jQuery(function($){
$('select').each(function(i, e){
if (!($(e).data('convert') == 'no')) {
//$(e).hide().wrap('<div class="btn-group" id="select-group-' + i + '" />');
$(e).after('<div class="btn-group" id="select-group-' + i + '" />');
var select = $('#select-group-' + i);
var current = ($(e).val()) ? $(e).val(): ' ';
select.html('<input type="hidden" value="' + $(e).val() + '" name="' + $(e).attr('name') + '" id="' + $(e).attr('id') + '" class="' + $(e).attr('class') + '" /><a class="btn" href="javascript:;">' + current + '</a><a class="btn dropdown-toggle" data-toggle="dropdown" href="javascript:;"><span class="caret"></span></a><ul class="dropdown-menu"></ul>');
$(e).find('option').each(function(o,q) {
select.find('.dropdown-menu').append('<li>' + $(q).text() + '</li>');
if ($(q).attr('selected')) select.find('.dropdown-menu li:eq(' + o + ')').click();
});
select.find('.dropdown-menu a').click(function() {
select.find('input[type=hidden]').val($(this).data('value')).change();
select.find('.btn:eq(0)').text($(this).text());
});
$(e).remove();
}
});
});

Resources