var cache = CacheService.getScriptCache();
let cached; var sheet = SpreadsheetApp.getActiveSheet ();
if(cache.get("cached")){
cached = cache.get("cached");
} else{ cached = 0; }
function test(){
cached ++;
sheet.getRange( 'A'+cached).setBackground( 'green');
cache.put("cached", cached); SpreadsheetApp.flush();
return cache.get("cached");
}
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries = [{name : "Refresh",functionName : "test"}];
SpreadsheetApp.flush();
sheet.addMenu("Calendar", entries);
};
function getJSON(url){
let rawJson = UrlFetchApp.fetch(url);
let json = JSON.parse(rawJson);
return json;
}
Закрашивает участки. Возможно проблема в том что формулу =test() не хочет пересчитывать? var cache = CacheService.getScriptCache();
let cached;
if(cache.get("cached")){
cached = cache.get("cached");
} else{ cached = 0; }
function test(){
cached ++;
cache.put("cached", cached); SpreadsheetApp.flush();
return cache.get("cached");
}
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries = [{name : "Refresh",functionName : "test"}];
SpreadsheetApp.flush();
sheet.addMenu("Calendar", entries);
};
=test()
$script = <<< JS
$("#combaine-region_id").change(function(){render()});
$("#point").empty();render();
function render (){
var region = $("#combaine-region_id").val();
if (isFinite(region)) {
$.ajax({
url: "/combaine/cities-region-list-ajax?id=" + region,
dataType : "json",
success: function (data, textStatus) {
cities(data);
}
});
$.ajax({
url: "/combaine/point-time?id=" + region,
dataType : "json",
success: function (data, textStatus) {
points(data);
}
});
}
function points(data){
var points = '';
for (var key in data) {
var result = data[key];
for (var key in result) {
points += result[key] + '<div class="form-group field-combaine-name"><input type="text" class="form-control" id="time[' + key + ']" name="Combaine[time][' + key + ']" value="" placeholder="Sunday"></div>';
}
$('*[data-id="'+key+'"]').append(points);
points = '';
}
}
function cities(data){
var result = '';
data.results.forEach(function(item, i, arr) {
result += '<div class="panel panel-default"><div class="panel-heading">' + item.text +'</div>' +
'<div class="panel-body" data-id="' + item.id + '"></div></div>';
});
$("#point").append(result);
}
}
JS;
$this->registerJs($script);
$('#contact-form').yiiActiveForm('add', {
id: 'address',
name: 'address',
container: '.field-address',
input: '#address',
error: '.help-block',
validate: function (attribute, value, messages, deferred, $form) {
yii.validation.required(value, messages, {message: "Validation Message Here"});
}
});
но почему то не работает $('#contact-form').yiiActiveForm('add', {
id: 'address',
name: 'address',
container: '.field-address',
input: '#address',
error: '.help-block',
validate: function (attribute, value, messages, deferred, $form) {
yii.validation.required(value, messages, {message: "Validation Message Here"});
}
});
ncaught TypeError: Cannot read property 'attributes' of undefined
at jQuery.fn.init.add (yii.activeForm.js:242)
at jQuery.fn.init.$.fn.yiiActiveForm (yii.activeForm.js:16)
at HTMLDocument.<anonymous> (create:1459)
at mightThrow (jquery.js:3583)
at process (jquery.js:3651)