Is there a way to have a selectInteraction in OpenLayers 3 that only allows one feature to be selected at a time?
define select interaction as follow:
select = new ol.interaction.Select (
toggleCondition: ol.events.condition.never
)
Not really sure I understood well.
If you go to the API doc for OpenLayers 3.4 and untick Stable Only on the page top right, you will see a multi option to manage this.
Normally, according to the doc, what you are asking is already by default.
Multi A boolean that determines if the default behaviour should select only single features or all (overlapping) features at the clicked map position. Default is false i.e single select
For OpenLayers4 this can easily be done by combining conditions.
For example a condition that only selects on singleClick and not when shiftKey is pressed:
const select = new Select({
condition: (mapBrowserEvent) => {
return singleClick(mapBrowserEvent) && !shiftKeyOnly(mapBrowserEvent)},
layers: [layer]
});
Find more conditions in the API doc: http://openlayers.org/en/latest/apidoc/module-ol_events_condition.html
Related
I built a table with a column with a " linked multiselect" filter, where the options of the second select depend on the first selection, and so on.
The problem is that as soon as I select an item, the filter dropdown close. I would like to close the popup when I finished all the selection.
I thought to intercept the onchange event in order to stop the propagation of the event. But it seems it's not possible.
Another option is to intercept the onClick event on the <option>, I tried but it didn't work.
Example:
https://codesandbox.io/s/8498m8ykxj
Luca
The popup container of the select (the options) is outside the filter dropdown.
Moving it inside (Select.getPopupContainer) solved the problem.
https://codesandbox.io/s/8498m8ykxj
I don't want to be that guy that does not understand what you are doing and gives advice. But if you need a multiple select, I would suggest to use a "multiple selection" input as you can find in the antd doc.
An other solution would be to use a Menu with chehkbox for each item. I think it would be much more easy to use.
That is just an idea.
Have a good day anyway
I'm trying to convert a small team to the benefits of using TFS with Visual Studio Online. I've created a custom process and custom work item type. I've also adde a few 'custom' states for items (eg: 'In Test').
Is it possible to create a query/chart similar to below, with a count of each item type - as below?
Create a new query to retrieve necessary work items
Go to your team project Home page (e.g. Home=>Overview)
Click Edit Dashboard=>Add Widget
Select Char for Work Items=>Add
Click Configure to configure this widget
Select corresponding Query
Select Chart type (e.g. Column)
Select State in Group by list
Click Save
Yes, VSTS supports dashboards that you can easily add widgets to. You can add dashboards on the Home tab by clicking + New in the upper right, and edit with the checkmark in the lower right. Have a look at the Chart for Work Items widget. Given a query of work items, it supports various chart visualization that you can configure and show.
Where do I make the initial function call to s_getLoadTime(). My library is being managed by Adobe.
https://marketing.adobe.com/resources/help/en_US/sc/implement/getLoadTime.html
Step 1: Add the plugin and timer start code
First, you need a Page Load Rule that is set to trigger at "Top of Page". If you already have an existing rule that triggers every page load at top of page, you can use that. If you do not, then create a new one.
Then, in the Javascript / Third Party Tags section, click on "Add New Script". Set the Type to "Sequential Javascript" and check the Execute Globally option.
In the code box, paste the following code:
// this is for older browser support
var inHeadTS=(new Date()).getTime();
// plugin
function s_getLoadTime(){if(!window.s_loadT){var b=new Date().getTime(),o=window.performance?performance.timing:0,a=o?o.requestStart:window.inHeadTS||0;s_loadT=a?Math.round((b-a)/100):''}return s_loadT}
// call plugin first time
s_getLoadTime();
Click on Save Code and then Save Rule.
Step 2: Make the 2nd call to plugin and assign to Adobe Analytics variables
Next, you need a Page Load Rule that is set to trigger at "Bottom of Page". If you already have an existing rule that triggers every page load at bottom of page, you can use that. If you do not, then create a new one.
Then, go to Conditions > Rule Conditions > Criteria and from the dropdown select Data > Custom and click "Add Criteria". In the code box, add the following:
_satellite.setVar('loadTime',s_getLoadTime());
return true;
Then within Adobe Analytics section of the rule, you can set your prop and/or eVar to %loadTime%.
Note: Using a rule set to trigger at "Onload" will technically be more accurate. However, DTM does not currently offer ability to trigger Adobe Analytics Onload (options are only for top or bottom of page), so if you set the rule to "Onload" it will trigger after AA has made a request so your variables will not be populated and sent in that request. If you really want to keep the accuracy then you will need to explore other options, such as implementing AA as a 3rd party script so that you have more control over when it triggers.
Click on Save Rule and then Approve/Publish once you have tested.
The question should really be, "Why should the getLoadTime() plugIn be used, ever?". Yasho, I started with the same question that you had and blindly implemented the plugIn in Adobe DTM following the instructions at https://marketing.adobe.com/resources/help/en_US/sc/implement/getLoadTime.html
Only after starting to analyze the data did I look into the plugIn to see what it does.
Below is the beautified code of the plugIn:
function s_getLoadTime() {
if (!window.s_loadT) {
var b = new Date().getTime(),
o = window.performance ? performance.timing : 0,
a = o ? o.requestStart : window.inHeadTS || 0;
s_loadT = a ? Math.round((b - a) / 100) : ''
}
return s_loadT
}
So, basically the function records s_loadT once and only once. The first call (way at the top of the page) sets the value and any subsequent call to the function will return that same value since it has been persisted in window.s_loadT
Scratch your head a bit and ask the obvious question, "So what does this measure anyway?" Best case, it measures the difference between window.performace.timing.requestStart and the timeStamp when the function was first called. Worst case it measures the difference between a timestamp set in the head of the document by javascript (and that difference could very well be a negative number). Or even worse if 'a' resolves to 0, you'll just get 'b' which will be a huge number.
If you are following the directions and calling getLoadTime() up high in the document (DTM page top rule), you're really just be measuring how long it takes to fire a page top rule. If you put the first call into the top of your s_code.js, you're just measuring how long it takes to load (and execute) s_code.js
What is the best way to add a column to a grid in Acumatica? I've looked at the documentation, and I can't seem to find a way to do it.
Thanks
It depends on the type of grid you are using. As an example, lets say you are going to add a CreatedDate column to the details grid of Journal Transactions screen.
You will need to switch to design mode and open up the Aspx Control Tree and select the PXGrid node, click Add, and select Add Column to Grid to open the Add Grid Column dialog.
Find the field you want to add (in this case CreatedDateTime). you can also create new cusomt field here by pressing Add. Pick the correct Column Editor type (like DateTimeEdit) and press OK
move the Column up and down using the left tree to put in position you want.
Validate and publish the project!
If you want to modify existing grid which was created by Acumatica you'll need following steps:
1. Add field in DB ( optional )
2. Add filed description in DAC extension
3. Add column to page in customization engine, or manually imitate behavior of customization engine
I need to allow users select ONLY allowed tags in select.
Currently I have that:
$("input#id_txtcolor").select2({tags:["red", "green", "blue"]});
Can you help me please with that?
as of 3.3 you can specify your own createSearchChoice when using tags that will always return null, thus preventing the default choice from being created.
$().select2({
createSearchChoice: function() { return null; },
tags:...
});
Sometimes we developer don't use our 7th sense that is common sense also happened with me struggled for 2 hours then it clicked my sense..
if you want user to select only allowed values then its no more tagging its selecting So just remove tags:true option and keep mulitple attribute in select, provide options directly in select element or load remote data.