How do I add a button to the header of the table. I'm using ng-table-dynamic and I have no idea.
I tried to use headerTemplateURL attribute but it doesn't work.
I don't want to use position to do the trick.
p/s: https://codepen. io/trungducng/pen/RwbqJpb
Just use headerTemplateURL and insert url of the component to it:
"headerTemplateURL": "button.html"
Trying to add the submit button dynamically through javascript, below is the code snippet, not sure which attribute to use for setting the text.
var dynSubmit = document.createElement("paper-button");
dynSubmit.setAttribute("on-click", "submitForm");
//dynSubmit.setAttribute("Value", "Submit");
parent.$.iron-form.appendChild(dynSubmit);
The commented code does not work, How do i set the caption of submit button?
You can set the button's innerHTML.
Polymer.dom(dynSubmit).innerHTML = "Submit";
Thanks to #jonsS0 for his handy comment.
Avoid using innerHTML with Polymer, or at all really; it's slow, it's where XSS can get in, and you shouldn't need it.
Instead use textContent:
dynSubmit.textContent = 'Submit';
You can set this without breaking the ripple and you shouldn't need the Polymer.dom(dynSubmit) as it's an exposed property on the underlying element.
Like there is a getElementById() in JavaScript to get a HTML tag and in Android to attach to UI Element , is there a way in GWT do all the stylings in basic HTML and CSS and just use GWT for event handling ?
In other words,
If I have in HTML :
<input type="button" id="refresh">
And in GWT :
Button b1 = new Button();
Can I bind these two together ?
~Thanks
Got the right answer :-
Button button = Button.wrap(Document.get().getElementById("submit"));
is working for me.
Please do at least basic research before posting questions. Anyways here is your answer
RootPanel.get("refresh");
I have my button that targets to index.html, but after I click them, my url above is domainname.lt/index.html, but all I want is domainname.lt. What should I do? I have no knowledge what to search. I'm using 'href' attribute.
Thank you in advance.
You should use PHP with the $base_url global variable. Here is a good tutorial on how to use it: https://api.drupal.org/api/drupal/developer!globals.php/global/base_url/7
Hope this is what you mean :D
Both domainname.lt/index.html & domainname.lt will display the same. If needed peculiar,
your link should be like this:
link
Use full url or set it to a variable as global.
$GLOBALS['a'] = 'domainname.lt';
I tried to find the solution but can't. I need a custom image for Pinterest (Pin It) button and pin some custom image by url but not a current page.
I created a custom link:
Pin It
in style I set the background image but I see only default Pin It button and not my custom button
There are some solutions where you can set custom button image for Pin It button but I can't change the media={ImageURL} in those solutions.
The popular solution is
<a href='javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)%7D)());'><img src='http://www.brandaiddesignco.com/blog/PinIt.png'/></a>
But it doesn't help me. Does any one know the solution?
Indeed the popular solution by Jeremy Mansfield at www.brandaiddesignco.com has a great method to customize the Pinterest button any way you want!
I've made three examples, in the form of jsFiddle's, so you can see how it's done using that method.
Reference: jsFiddle Text-Link method
Reference: jsFiddle Custom Logo method
Reference: jsFiddle Custom Logo and Image method
For more Pinterest Info, see my other SO Answer.
Adding an encoded whitespace before the last fragment of the URL will prevent Pinterest's JS from "hijacking" the link:
//pinterest.com/pin/create/%20button?url=
Update:
It seems that my previous solution doesn't work anymore. Here is another one:
//pinterest.com/pin/create%2Fbutton/?url=
At the risk of over simplifying things, use your 'http://pinterest.com/pin/create/button/?url=' path that you've already got, set up your variables, and append them as you do, and just don't include any pinterest javascript. Without that js, it won't find the link and replace it out with their own pinterest button. Just customize your link with an image inside it (or set a background image or whatever) and screw the pinterest js. Set the target to open in a new window.
Custom Link/Button looks like this:
<a href="http://stackoverflow.com/questions/11312923/custom-pinterest-button-for-custom-url-text-link-image-or-both" data-image="http%3A%2F%2Fcdn.sstatic.net%2Fstackexchange%2Fimg%2Flogos%2Fso%2Fso-logo.png" data-desc="Custom Pinterest button for custom URL (Text-Link, Image, or Both)" class="btnPinIt">
Custom Pin it image or text here!
</a>
Note: I don't think the data attributes need to be encoded (like I did for data-image) but it doesn't seem to hurt it.
JQuery:
$('.btnPinIt').click(function() {
var url = $(this).attr('href');
var media = $(this).attr('data-image');
var desc = $(this).attr('data-desc');
window.open("//www.pinterest.com/pin/create/button/"+
"?url="+url+
"&media="+media+
"&description="+desc,"_blank");
return false;
});
Here is what worked for me :
<img src="../img/custompinint.png" />
The attribute data-pin-custom is what I picked up from Pinterest documentation.
Hope this helps.
After a bit of trial and error, below is what worked for me. This response is a combination of #rharvey's response thread and another stack overflow post. This solution opens up a pop up to share content via pinterest.
Note: In order to prevent 2 windows from popping up you need to set a target. Below is the full solution:
<a href="http://stackoverflow.com/questions/11312923/custom-pinterest-button-for-custom-url-text-link-image-or-both" data-image="http%3A%2F%2Fcdn.sstatic.net%2Fstackexchange%2Fimg%2Flogos%2Fso%2Fso-logo.png" data-desc="Custom Pinterest button for custom URL (Text-Link, Image, or Both)" class="btnPinIt" target= "pinIt">
Custom Pin it image or text here!
</a>
<script>
$('.btnPinIt').click(function() {
var url = $(this).attr('href');
var media = $(this).attr('data-image');
var desc = $(this).attr('data-desc');
window.open("//www.pinterest.com/pin/create/button/"+
"?url="+url+
"&media="+media+
"&description="+desc,"pinIt","toolbar=no, scrollbars=no, resizable=no, top=0, right=0, width=750, height=320");
return false;
});
</script>
Works for me perfectly.
Your script
<script>
function pinIt()
{
var e = document.createElement('script');
e.setAttribute('type','text/javascript');
e.setAttribute('charset','UTF-8');
e.setAttribute('src','https://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);
document.body.appendChild(e);
}
</script>
Call it with
Pin