I’m having an issue where I am setting a component's data with something like this
document.querySelector("#card1")
.setAttribute('card', {assetArray: items.swapper_1,
deletedItemNum: nextProps.projects.deletedItemNum,
deleteUpdate: true});
then in my update function I’m setting the deleteUpdate value back to false. But, when I come back around to update the component again with something like this
document.querySelector("#card1").setAttribute('card', "assetArray", items.swapper_1);
a-frame is using the cached value of deleteUpdate which is true because, I'm assuming, I had used it in the previous .setAttribute. Then, in my update function, this.data.deleteUpdate is now true even though I had set it back to false. Not sure how to work around this.
How are you setting deleteUpdate? .setAttribute('card', 'deleteUpdate', false)?
Or you can just use this.deleteUpdate = false; for state variable.
I ended up having to set this.attrValue.deleteUpdate to false at the end of my update function. I guess the cached values used for .setAttribute are stored there and when you are updating attributes, any undeclared value that you are using will use the cached value as I suspected. I could be wrong on how it's working but that's what it seems like.
Related
how can I enable or disable a CheckButton via code? Is there any simple way like "input pickable true/false" I use with collision shapes? I played around with control focus modes but didn't succeed.
For example: I'd like to have a timer starting when button down / holding down and after a certain time the button shouldn't react at release anymore. Just as if it was never put down in the first place...
There must be a simple command for that, right?
Edit:
Trying
my_button.disabled = true
leads to the error
Invalid set index 'disabled' (on base: 'GDScriptNativeClass') with value of type 'bool'.
It sounds like you're looking for the pressed property.
my_button.pressed = true
The documentation isn't very clear on the usage but it does what you're describing. https://docs.godotengine.org/en/stable/classes/class_checkbutton.html
I am using JMS\Serializer in my project and I want to ignore one property only if the array in it is empty.
I tried something like :
#JMS\Exclude(if="count('$this->required') === 0")
or
#JMS\Exclude(if="empty('required')")
but got a syntax error.
Can anyone help me on this?
thank.
What you need was implemented recently and it is in release-1.7 so you might as well wait for it. It is called #SkipWhenEmpty
#SkipWhenEmpty This annotation can be defined on a property to
indicate that the property should not be serialized if the result will
be "empty".
This is the bug related it.
You need this one:
#JMS\Exclude(if="!object.required")
I'm trying to pull some fields from my Document Library. Right now, I can retrieve these 2 fields to return the correct values, in my success function.
while (listItemEnumerator.moveNext()) {
var oListItem = listItemEnumerator.get_current();
alert(oListItem.get_item('Title'));
alert(oListItem.get_item('UserField1'));
}
But when I try to call a computed field, such as 'NameOrTitle' oListItem.get_item('NameOrTitle')); I get IE telling me the property or field has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
This value has content inside it right now. And I need it, as it's displaying the file name. How can I get this field? I have looked elsewhere and I have read stuff about doing:
context.load(allItems, 'Include(NameOrTitle)');
Then in my succeess function, I do oListItem.get_nameOrTitle(). Is this correct?
Well I do that and now I'm getting
Object doesn't support property or method 'get_nameOrTitle'
Please help. Thanks.
oListItem.get_item('FileRef');
Will get me the url
When I call this:
buttonrow1.checkedButton = _button1
then I get no errors and nothing happens, I can also not change the property using states, no matter what I do it just remains at the default setting. Any idea how I can change this value?
buttonrow is not a built in type. So please add your definition and tell us what you need to do with:
buttonrow1.checkedButton = _button1
I must be missing something really obvious here:
I have a user whose locale is set to America/Los Angeles. When I look in the 'users' database table, they have a value of -28800 for the timezone field. This makes sense; 8 hours before GMT = -28800 seconds.
But now, when the user changes his locale to America/New York, the value of timezone stays the same, rather than switching to -18000, 5 hours before GMT. Why isn't this change happening? If I'm looking in the wrong place, where would I find a timezone value that matches their locale?
The server's timezone is also set to America/Los Angeles, if that matters. Thanks!
Sounds like a bug. What version of Drupal? Either way, you should be able to fix it fairly easily with hook_user. You'll need to do a user_save and explicitly define the new timezone value. It'd be something like this:
function trnAccount_user($op, &$edit, &$account, $category = NULL) {
switch($op) {
case 'update':
user_save($account, array('timezone' => $myTimeZone);
break;
}
$myTimeZone is a placeholder. Do a print_r on the incoming $edit within this hook and you should be able to find where the timezone change has been recorded then just replace $myTimeZone with that array path (for example... $edit['values']['timezone']). If its not coming through at all then something is wrong with the form you're using the change the locale.
If you're using a form you wrote yourself, you could also handle this in the submit function for that form.
ARGGH -- FALSE ALARM. Just as I was wrapping all this up, I thought it might be worth checking another of my Drupal sites to see what happens with $user->timezone there. Turns out that it's working correctly -- change the locale in the user edit page and $user->timezone changes as it ought to. Thus, I'm screwing the pooch somewhere in my current site; Drupal itself seems to be OK. Apologies for wasting your time; but many thanks in any case.