I have few input and select controls in my form that each of them have a small question mark icon in front of them that will show a tool tip when mouse is over that gif with help of excellent jquery jquery.qtip-1.0.0-rc3.js(with jquery-1.3.2.min.js) plug-in like this :
$('#questionmark1').qtip({
content: 'sample help content'
, style: { name: 'sampleStyle' }
, position: { corner: { target: 'bottomLeft', tooltip: 'rightTop'} }
});
I also want to show tool tip when ever that corresponding input field get focused and hide when get blurred . the following one do the trick but without showing the tool tip when mouse is over that gif
$('#questionmark1').qtip({
content: 'sample help content'
, style: { name: 'sampleStyle' }
, position: { corner: { target: 'bottomLeft', tooltip: 'rightTop'} }
, show: { when: { target: $('#input1'), event: 'focus'} }
, hide: { when: { target: $('#input1'), event: 'blur'} }
});
but the problem is that something like does not work.
show: { when: { target: $('#input1'), event: 'focus'},
{ target: $('#questionmark1'), event: 'focus'} }
in short the preceding first 2 blocks of code works fine and i can add both to achieve my goal but i want do it the right way .
how can i target multiple targets'events for showing a single tool tip ?
You don't have to wire up all of the show/hide events inside of the call to qtip(). I'd define the mouseover event as the event that triggers the qtip by default:
$('#questionmark1').qtip({
content: {text:'sample help content', prerender: true}
, style: { name: 'sampleStyle' }
, position: { corner: { target: 'bottomLeft', tooltip: 'rightTop'} }
, show: { when: 'mouseover' }
});
(Note the prerender option I added)
And then manually define event handlers for the input that you want to show the qtip for:
$("#input1").bind("focusin", function() {
$("#questionmark1").qtip("show");
}).bind("blur", function() {
$("#" + this.id + "-tip").qtip("hide");
});
See an example here: http://jsfiddle.net/andrewwhitaker/wCgAM/
The only odd thing is that you can make both tooltips show up by focusing the first input and then mousing over the second question mark. This is probably easy enough to fix though.
Hope that helps.
Related
I'm trying to figure out a solution to wrap text around images within a markdown document using Gatsby. I have tried the wrapperStyle option but not entirely sure how to get it to work. I've seen on Gatsby's website using the following code:
wrapperStyle: fluidResult => `flex:${_.round(fluidResult.aspectRatio, 2)};`,
But I am very novice to coding and am unsure how to read this (I'm a technical writer by trade). Also, adding this makes my images disappear when I build the repo.
Here is a condensed snippet from my gatsby-config.js file in case someone is unsure of where I'm talking about in gatsby-config.js.
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 800,
},
I think you are looking for showCaptions or markdownCaptions option of gatsby-remark-images plugin. Use it like:
{
resolve: 'gatsby-transformer-remark',
options: {
plugins: [
{
resolve: 'gatsby-remark-images',
options: {
showCaptions: true
}
}
]
}
}
Or customize the element of the caption like:
{
resolve: 'gatsby-remark-images',
options: {
showCaptions: ['title', 'alt']
}
}
}
Note: with this configuration, if you set the title, it will be used as the caption. Otherwise, if you set the alt attribute, it will be used instead
You can find the result of the configuration in this GitHub thread:
Related articles:
https://medium.com/#sgpropguide/customising-image-display-in-gatsby-3b027d783dce
https://codeconcisely.com/posts/how-to-add-markdown-image-captions-in-gatsby/
How is sorting and filtering implemented when using a custom header cell in the react-data-grid?
{
key: "myColumn1",
name: "My Column Name",
headerRenderer: this.renderHeader,
sortable: true,
filterable: true
},
{
key: "myColumn2",
name: "My Other Column Name",
sortable: true,
filterable: true
}
...
renderHeader(props){
return (<extra-stuff>
{props.column.name}
</extra-stuff>)
}
I have myColumn2 sorting fine but nothing happens with the custom header: myColumn1. What do I need to do in renderHeader(){} to get sorting (and filtering, but mainly sorting) working?
Instead of trying to call a function in headerRenderer, put a component instead:
{
key: "myColumn1",
name: "My Column Name",
headerRenderer: <renderHeader value={this.renderHeader()} />,
sortable: true,
filterable: true
},
Looks like a solution was checked-in for this almost a year ago. I do work on an intranet and don't have direct internet access for development so maybe i have an older version. Since I can't get the version in my environment I'll wait for someone to verify that the latest version works as expected before I accept my own answer (or I'll try to get the latest version with the change in there.)
One other thing I will have to do with the way the solution was implemented is stop propagation of the click event because in my custom header i have a ReactIcon that is clickable to change from status wording to a menu. So, if they click right on the icon in the header do the name/menu change and if they click anywhere else in the header then do the sort. I'll have to look up how to do that in React.
Update
I took the changes from the check-in in the link above and added them to my react-data-grid.js and it works great. I.e. I had to add the changes to the pure javascript version of the code that npm pulled into our node_modules.
I also did have to use e.stopPropagation() call in my headerRenderer like i thought i'd have to so that clicking the icon i have in the headerRenderer would not sort when click (but just do a different operation) but it was easy to add.
I do have one question about the change i made to my js which here is a piece of the change...
return React.createElement(
'div',
{className: className,
onClick: this.onClick,
style: {cursor: 'pointer'} },
React.createElement(
'span',
{ className: 'pull-right' },
this.getSortByText()
),
//change was here from just: this.props.column.name
this.props.column.headerRenderer? this.props.column.headerRenderer(this.props) : this.props.column.name
);
How would i have done this in JavaScript so that it would work whether my headerRenderer was ()=>{ return <span>...</span> } or <MyComponent /> ???
Since i always use functions for my headerRenderer i just did the change so that it worked the one way but would like to know how to make the change so it works both ways. Something like this? ...
this.props.column.headerRenderer?
(isFunction(this.props.column.headerRenderer)? this.props.column.headerRenderer(this.props) : React.createElement(this.props.column.headerRenderer, {...this.props}) )
:
this.props.column.name
????
I'm using sap.ui.comp.filterbar.FilterBar Control on a project. Everything works fine, except when I try to hide this Control.
var oFilterBar = new sap.ui.comp.filterbar.FilterBar("filterBar",{
reset: oController.handleOnReset,
search: oController.handleOnSearch,
showRestoreOnFB: true,
showClearOnFB: true,
showRestoreButton: true,
showClearButton: true,
...
});
oFilterBar.setVisible(false);
I'm getting the following error:
Uncaught TypeError: oFilterBar.setVisible is not a function
Since this property is being inherited from sap.ui.core.Control class, this should work and I think it has nothing to do with versions either (I'm using 1.24).
It has something to do with the version.
In SAPUI5 1.28[1] the property visible was moved to sap.ui.core.Control so any Control extending it would have this property as well.
If you are using an earlier version only Control that implement this property themselves can be made invisible.
You could however extend the control you are using to include this property:
sap.ui.comp.filterbar.FilterBar.extend("my.FilterBar", {
metadata: {
properties: {
visible: {
type: "boolean",
group: "Appearance"
}
}
},
renderer: function (oRm, oControl) {
if (oControl.getVisible()) {
sap.ui.comp.filterbar.FilterBarRenderer.render(oRm, oControl);
} else {
// Handle invisibility
}
}
});
I started using the gmap3 jQuery plugin today and I'm having issues with getting a list of markers.
As long as I add all the markers manually (with addMarker or addMarkers) all works well and the:
.gmap3({action:'get', name:'marker', all:true});
gives proper list of markers.
However, if i use the action:getRoute and the addDirectionsRenderer - the markers are not 'gettable' by code pasted above.
My code for showing the directions is below - it works and shows them properly on the map. Only issue is that I cannot get any markers out of it, so I can process them after creation.
var optionDirections = {
origin: startcoord,
destination: stopcoord,
waypoints: coordsAllGoogleStyle,
optimizeWaypoints: true,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
....
.gmap3({
action:'getRoute',
options: optionDirections,
callback: function(results) {
if (!results) { alert('nodata'); return; }
$(this).gmap3(
{
action:'addDirectionsRenderer',
options:{
preserveViewport: false,
draggable: false,
directions:results
}
}
);
var res = $(this).gmap3({action:'get', name:'marker', all:true});
alert('Found: '+res.length+' markers');
}
});
to make things simple, I contacted the author of this api and it kind of not support it anymore because "now people use angular"
nice is'nt it...
I am new to JqGrid, so please bear with me. I am having some problems with styling the cells when I use a showlink formatter.
In my configuration I set up the AfterInsertRow and it works fine if I just display simple text:
afterInsertRow: function(rowid, aData) {
if (aData.Security == `C`) {
jQuery('#list').setCell(rowid, 'Doc_Number', '', { color: `red` });
} else
{
jQuery('#list').setCell(rowid, 'Doc_Number', '', { color: `green` });
}
}, ...
This code works just fine, but as soon as I add a formatter
{'Doc_Number, ..., 'formatter: ’showlink’, formatoptions: {baseLinkUrl: ’url.aspx’}
the above code doesn't work because a new element is added to the cell
<a href='url.aspx'>cellValue</a>
Is it possible to access programmatically the new child element using something like the code above and change the style?
`<a href='url.aspx' style='color: red;'>cellValue</a>` etc.
UPDATE: In order to work you have to do as follow:
jQuery('#list').setCell(rowid, 'Doc_Number', '', 'redLink');
CSS Class
.redLink a {
color: red;
}
You could add a class to the cell:
jQuery('#list').setCell(rowid, 'Doc_Number', '', 'redLink');
Then define a CSS class along these lines:
.redLink a {
color: red;
}