I found that I can't do this by UIAPickerWheel.selectValue(), any idea?
you can pass your value in picker like this:
Picker.wheels()[1].selectValue(Your_Value);
in wheels()[1], [1] is your wheel number.
I have had difficulty using the UIAPickerWheel selectValue function on a picker with date month and day, as shown on the first (leftmost, zero index) wheel from the image below. The only solution that has worked for me, not optimal, is to tap some specified number of times above (below) the current selected value. The following code will tap above the selected value to decrement the date daysAgo times.
var datePicker = this.popupWindow().pickers()[0];
for (var i = 0; i < daysAgo; ++i) {
datePicker.wheels()[0].tapWithOptions({tapOffset:{x:0.81, y:0.30}});
this.target().delay(.4);
}
Related
I have a list of 100 employees and 50 dropdowns. I want to select some of the employees in the dropdowns but I want to prevent the user from choosing the same employee more than once.
I want to deduct the chosen employees from the possible dropdown answers. How can I manage to do so?
I tried to filter out the selected employees but it shows an ugly warning sign for those who were selected
you can view my spreadsheet here:
https://docs.google.com/spreadsheets/d/1bzMPC3-SDOjsgZVXHQgmfBnkiTEsa1Pei7p_DybIebY/edit?usp=sharing
You can use the Simple Trigger onEdit(e) to automatically do the job:
The onEdit(e) trigger runs automatically when a user changes the value
of any cell in a spreadsheet [...]
It's not exactly the same as you had before, because the selected values will still be displayed on the list. They just will be removed if they are repeated.
The only change you should do is to remove the current Data Validation from Column D and set a new one with values from Column A.
function onEdit(event){
if (event.range.getColumn() == 4){ //Run only if the edited cell is from column D
var sheet = SpreadsheetApp.getActiveSheet();
var selection = sheet.getRange("D2:D22").getValues();
var editedRow = event.range.getRow(); //Gets the edited row
for (var i = 0; i < selection.length; i++){
//If some value from D is equal to the edited value but in a different Row (so it ignores the inputted value)
if ((i + 2) != editedRow && selection[i][0] == event.value){
sheet.getRange(event.range.getA1Notation()).setValue(""); //Change the new value to empty
}
}
}
}
The function will run every time you select an item in the column D.
Result:
References:
Range
Sheet
setValue
i have a google spreadsheet document with dates on the left rows:
1.1.2016
2.1.2016
.....
i want to highlight days that have already passed, and i have got this code:
function myFunction()
{
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheetSelect = ss.getSheetByName("test");
var todayis = getCell(1,12);
{
for(var i = 0; i<sheetSelect.getMaxRows();i++)
{
if (getCell(i,1) == todayis)
{
var changeRange = sheetSelect.getRange(i,1);
changeRange.setBackgroundRGB(111, 111, 222);
}
}
}
}
This is not working, any suggestions ?
There's a less-complicated way to do it:
Right click on the cells you want to conditionally highlight.
Click "Conditional Formatting" from the right-click menu.
Under "Format cells if...", select "Date is before"
In the next drop-down select "today"
Select the background color you want.
Click "Done"
You can do this without a google apps script also if your dates are all formatted into text as it shows in your example you can use the conditional formatting with a custom formula - highlight the column you want, choose conditional formatting and enter in this formula:
=arrayformula(if(DATEVALUE(substitute(A1:A,".","/"))<today(),true,false))
I've got a chart that where allow the user to view the data grouped by day, week, or month. The problem is that if you use the navigator the month columns grow and shrink as the navigator moves or is resized. If the user moves the navigator to the middle of a month, the column graph above shows that that month is off by half. Is there a way to make the navigator be limited by monthly increments?
Only solution is to use afterSetExtremes() or setExtremes() and there update extremes to required ones.
I think this will work, edited to UTC date
I also wrote in a 1 second delay to avoid it triggering too much
events: {
afterSetExtremes: function (e) {
minFirstDay = new Date(e.min);
minFirstDay = Date.UTC(minFirstDay.getFullYear(), minFirstDay.getMonth(), 1);
maxFirstDay = new Date(e.max);
maxFirstDay = Date.UTC(maxFirstDay.getFullYear(), maxFirstDay.getMonth(), 1);
setTimeout(function(){
if (e.min != minFirstDay || e.max != maxFirstDay) {
navChart.xAxis[0].setExtremes(minFirstDay, maxFirstDay);
console.log('date range updated');
};
}, 1000);
}
}
I need to use a Range Slider to set a time range (8-23) but I need some base conditions on it (I basically need the minimum range to be 1h):
When the two pickers are on the same position the right piker goes "+1"
On right limit (23) the values have to be "22,23)
Here is the code as I tested so far: JSFiddle URL
This works only before the right limit of the slider, when I have "23,23" or "22,23" my getSlide check function does not work properly and I don't understand how to fix it..
Any help?
Thanks!
I solved myself coding all conditions only in slide event:
...
slide: function (event, ui) {
val1 = ui.values[0];
val2 = ui.values[1];
if(val2-val1 < 1 || val1 > 22){
return false;
}
$("#start").text(ui.values[0]);
$("#stop").text(ui.values[1]);
},
...
The strange behaviour with the previous version is still not explained, but it works.
I want to use jquery fullcalendar but I want to hide certain hours.
I want to show the calendar from 8.00am->11.00am and from 16:00pm->19:00pm
So the hours between 11:00am and 16:00pm must be 'hidden'.
I don't see an option to do this :
How can I force this ?
thx in advance
Kristof
You don't want to modify fullcalendar source because you want to be up to date with official branch.
Then the only way is to hide appropriate rows (hours) after fullcalendar initialization with javascript:
//hide rows with unused hours. Class names can be found in html source of
//rendered fullcalendar (fc-slotxx)
for(var i=0; i<gapshours.length; i++)
{
var gapclass = '.' + gapsclasses[i];
$(gapclass).hide()
}
//display hours for clipped borders
for(var i=0; i<sethourhours.length; i++)
{
var hourclass = '.' + sethourclasses[i] + ' th'
$(hourclass).text(sethourhours[i]);
}
After that you must remember of clipping and moving events' periods just for view purposes.
It would be very helpful to see your code; here's my best guess.
In your fullCalendar initialization code, I would use an event generating function (see event generating function)
events: function(start,end,callback){
//get your data from wherever you're getting it
var events = some_ajax_method(start, end);
//filter it down to the times you want to show
events = $.map(events, function(event){
if (event meets time criteria)
return event
else
return null;
});
callback(events);
}