w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Ajax view updates doesn't work properly in custom components with dedicated java class
I discovered where the problem is. I thought that when a component gets updated it was entirely reprocessed, but it doesn't happen in some occasions. For some reason, it seems that when ui:repeat is used, JSF tries to retard the component reset. A solution is to explicitly recalculate the list when getList() is called: It was like this before: public ArrayList<String> getList() { if (null == list) generateList(); return list; } } If I remove the verification for null it works. In my opinion that's what was happening: when the component was updated the list still had the values calculated before, it was not null and no recalculation was done. In the time between one request and another, the component was getting reconstructed. With the component reseted, list

Categories : JSF

View Scope doesn't work in faces-config.xml
JSF doesn't do that. You're apparently being misled by the IDE (e.g. Eclipse) giving this warning as if it came from JSF itself. Note that it works fine when you ignore this warning and run the project as is. You've apparently configured your IDE project to be a JSF 1.x project instead of a JSF 2.x one. You'd need to set it right in the project facets configuration in IDE project's properties. Unrelated to the concrete problem, since JSF 2.0 there's no need to register beans in faces-config.xml anymore. You could just use @ManagedBean and friends for that.

Categories : JSF

angularjs: directive creates two child scope(not isolation scope)? and how to get scope of an element?[Solved by clear answer]
it's hard to figure out without any jsfiddle for the context. What is your link function? and what is your controller function? By the way, it is the normal behaviour as documentation says transclude:true creates also a new scope. Look at here : https://github.com/angular/angular.js/wiki/Understanding-Scopes The transcluded and the isolated scope (if any) are siblings -- the $parent property of each scope references the same parent scope. When a transcluded and an isolate scope both exist, isolate scope property $$nextSibling will reference the transcluded scope. So if you want to access the 2 siblings from one another, you have to use a 2-way binding with their parent

Categories : Angularjs

scope on Date.current only updates when Rails restarts
When you set up a scope with a time in it you need to use a lambda expression to ensure that the time call is evaluated each time the scope is used. There are more details in the rails guide but your scope needs to look more like: scope :current, lambda { where(["petitions.date <= ?", Date.current]) }

Categories : Ruby On Rails

Anyway to trigger a method when Angular is done adding scope updates to the DOM?
Using timeout is not the correct way to do this. Use a directive to add/manipulate the DOM. If you do use timeout make sure to use $timeout which is hooked into Angular (for example returns a promise).

Categories : Angularjs

AngularJS Directive with no Template and Sharing the updates from parent scope
You can remove the $watch in the directive if you adopt the following approach. You should use the object interpolation html.push("{{" + attrs['zippy'] + "}}"); instead of the serialized plain text string if you want the model to be interpolated and updated. app.directive('zippy', ['$compile', function ($compile) { return { restrict: 'A', link: function (scope, element, attrs) { var html = []; html.push('<hr/><div class="clearfix" id="vote-icons" ng-click="primitiveTest(' + attrs['zippy'] + ');" >Update Name </div> - <div class="clearfix" id="vote-icons" ng-click="objectTest(' + attrs['zippy'] + ');">UpdateObject'); html.push('</div>'); html.push("{{" + attrs['zippy'] + "}}"); el

Categories : Javascript

Scope object doesn't change without $scope in Angularjs
The reason is you are creating a new object (and therefore a different reference) and assigning it to a local variable that was previously pointing to the same object. $scope.change = function (data) { data = { name: 'change', game:'change' }; } The data variable passed holds a reference to the same object of your $scope.data but you are assigning a local variable pointing to a reference of an object A to a new object B, locally. At that point, $scope.data still holds a reference to the same object it has before. All you are doing is changing the reference to the local variable and discarding it at the end of the function. In your specific case, it should work (using current or $scope.current). I believe you are inverting the parameter in angular.copy as it should be (source, desti

Categories : Javascript

Increasing TextSize of TextView and then Decreasing It Doesn't return to normal height of view element
Whether this answer helps much or not, I think android:layout_weight="0" is redundant. A weight statement (say android:layout_weight="1") is also more usually accompanied by a android:layout_height="0dp" or android:layout_width="0dp", depending on the orientation of the containing LinearLayout.

Categories : Android

Remove from Observable collection in ViewModel does not update View, but Updates of Existing Items does update View
The code you're pasting should work, from what I can see. The most likely culprit is that your TransactionUpdateReceived event is being raised on a thread that is not the user interface thread. In WPF, single items can be modified on a background thread, but collections cannot (prior to .NET 4.5, but in .NET 4.5, they require extra work). There are two options. If you're using .NET 4.5, you can use BindingOperations.EnableCollectionSynchronization to allow the ObservableCollection to be modified from a background thread. Alternatively, you can use Dispatcher.Invoke to push the Add/Remove calls onto the main thread.

Categories : Dotnet

Insert another element with attribute value or scope model after directive element in AngularJS
Set up a scope on the directive to pass each item: app.directive('insertDd', function ($compile) { return { restrict: 'A', scope: { item: '=insertDd' }, link: function (scope, element, attrs) { // ng-repeat always inserts the next item directly after the last one, // so this element will actually be before the <dt> we just added if (element.next().length) { element.next().after(element); } var dd = angular.element('<dd> here is {{item.dd_value}} or {{item.dt_value}} </dd>'); element.after(dd); $compile(dd)(scope); } }; }); http://jsfiddle.net/sFEf5/2/

Categories : Angularjs

AngularJS/ng-grid - Updating array with splice doesn't updates UI
That's because data $watcher in ng-grid (incorrectly) compares the data object for reference, instead on object equality. You might remedy this by setting the third parameter to true in data $watch function (line 3128): $scope.$parent.$watch(options.data, dataWatcher, true); Plunker

Categories : Javascript

Android Custom View with time-based updates
Probably invalidateSelf() on the drawable with your timer...you can check the developer docs for the details. Note the "Does nothing if there is no Callback attached to the Drawable" statement, or nothing will happen!

Categories : Android

Make a scrolling view that updates as users scroll down
You need to have a PHP script which returns the data in JSON when requested by a client-side AJAX call. If you want the results ranked, this should be easily performed in your query. I have used this jQuery plugin many times, the examples are plentiful: DataTables

Categories : PHP

BackBone.js Child View not Rendering it's element when Parent View Adds Child's Targeted Element
This is happening because the child's element is just being rendered in memory and never added to the DOM. You have #child as the element for the Child view, but this isn't in the HTML. So you could change your HTML to: <div id="parent"></div> <div id="child"></div> Which will put "World" into the DOM, inside #child.. However, I'm assuming because these are named parent and child, you actually want them nested in which case the parent would be in charge of rendering the child. If so, change your child view to: var Child = Backbone.View.extend({ id: 'child', render: function () { this.$el.html('World'); return this; } }); This removes the 'el' selector and adds and 'id' property instead, because this is being dynamically created. Se

Categories : Backbone Js

View only updates on the next $digest, when modifying it inside of a directive's controller
Just use $timeout on the listener (inject it in the directive definition: scope.$on('$destroy', function (ev) { $timeout(function() { controller.removeItem(scope); }); }); This will ensure that the removeItem is called inside an $apply block. The good thing of this approach is that 1. If you are already in an $apply block, nothing different happens 2. If there is an $apply scheduled, then the function is put at the end of the already scheduled block 3. Otherwise, a $digest will be scheduled for ASAP, with the function inside. So it's a win-win :)

Categories : Angularjs

App Built with Phonegap Build Servers Doesn't show for Tablets - Android Manifest Updates
I bet you have permissions issues. Here are the things to try to modify, and see if the tablets show up as options. If a tablet does not have a particular hardware feature, then it will not show up if you have a permission for it in the list (without modification). For example, if the Nexus 7 doesn't have a microphone, then the "record_audio" permission will block it from being available on the store, until a line like this is added.... so basically you need to review each permission, and determine what hardware is needed for these permissions to work, and add line like the above to let the manifest know that it is not required (required="false") use this list @ http://developer.android.com/guide/topics/manifest/uses-feature-element.html#permissions and go to the area called "Perm

Categories : Android

Avoid ng-view getting "wiped" (updated) when $location.search updates GET params
This is because updating the URL params triggers the route again and this is causing the controller to be reloaded. There is a simple fix for this. Use the property reloadOnSearch and set it to false. This will not reload the controller when the $location.search() changes $routeProvider .when('/', { templateUrl: 'views/map.html', controller: 'MapCtrl', reloadOnSearch: false }) .otherwise({ redirectTo: '/', controller: 'MapCtrl', reloadOnSearch: false }); });

Categories : Angularjs

Removing element by EQ filtering doesn't remove the element from jQuery Object
Why the jQuery keeps the element in the group of the matched elements? In case you want to do something with it after removing it. remove removes the element from the DOM, but you may well want to do something further (like adding it elsewhere in the DOM or retrieving information from it). You can remove it from the set using slice or not (or more accurately: You can get a new object with all the same elements except the ones omitted by slice/not): previewItems.eq(index).remove(); previewItems = previewItems.not(previewItems[index]);

Categories : Jquery

How to attach Backbone.Marionette view to existing element without creating extra element
For this, you should use the attachView method: https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.region.md#call-attachview-on-region

Categories : Backbone Js

how can I exclude an element from an Angular scope?
Have you tried ng-non-bindable? http://docs.angularjs.org/api/ng.directive:ngNonBindable <ANY ng-non-bindable> ... </ANY>

Categories : Angularjs

Scroll position in Text View object on detail view doesn't reset when returning
Since you are reusing a HardlyWorkingDogsDetailViewController, this behavior makes sense. If HardlyWorkingDogsDetailViewController is light weight enough, there really isn't any need to reuse it. Simply reinstantiating it everytime should fix your problem: self.detailViewController = [[HardlyWorkingDogsDetailViewController alloc] initWithNibName:@"HardlyWorkingDogsDetailViewController" bundle:nil ]; Dog *dog = self.sortedDogDictionaryArray[indexPath.row]; self.detailViewController.dogName= dog.dogName; self.detailViewController.dogLicense = dog.licenseString; self.detailViewController.dogScrollingInfo = dog.whatMakesDogSpecial; self.detailViewController.dogPhoto = dog.dogPhoto; [self.navigationController pushViewController:self.detailViewController animated:YES]; Although, having not

Categories : Iphone

MBProgress view and pushing a view controller doesn't display
You don't need to add self.HUD to self.view, showHUDAddedTo: does it for you. [self.HUD showWhileExecuting:@selector(loadCreate) onTarget:self withObject:nil animated:YES]; Shows the hud until loadCreate returns. [self performSelectorOnMainThread:@selector(dataLoadMethodMail) withObject:nil waitUntilDone:YES]; dispatches something on main thread and returns right after (before the actual end of dataLoadMethodMail). The HUD is shown but disappears right away. To solve the issue try hiding manually the HUD when dataLoadMethodMail finishes it's work. Just replace [self.HUD showWhileExecuting:@selector(loadCreate) onTarget:self withObject:nil animated:YES]; with [self loadCreate]; and add dispatch_async(dispatch_get_main_queue(), ^{ [self.HUD hide:YES]; }); at the end of

Categories : Iphone

Posting a runnable to a View that invalidates the View sometimes doesn't work
Try this : setBitmap() like this : runOnUiThread(new Runnable() { @Override public void run() { thumb.setImageBitmap(b); } });

Categories : Android

What's the scope of MYSQL VIEW?
A view definition is a peristent object, like a table. The dynamic part is when you try to read data from it. Then the underlying SELECT is executed on-the-fly. Its primary purpose is to encapsulate a complex query so that it can be used later just like a regular table, exactly the same way as a function in imperative languages. You do not create a function every time you need something done, instead you create a generic parametrised function. Depending on the situations, you then call the function with different parameters. Unless you are creating a database administration tool, do not construct dynamic views. Instead, you may want to create this view once and for all in your database but without the variable WHERE conditions. Then use the view from your code by issuing queries like:

Categories : Mysql

scope change doesn't execute code in directive
I believe that in your directive definition you need: ngModel: '=' instead of: ngModel: '@' If you want to use the '@', your view should be: <notification data-ng-model="{{message}}"></notification> Also in your $watch you should be watching for ngModel and not message.

Categories : Javascript

Bash: Nested if-statement doesn't finish scope
The fact that nothing is running after debugout indicates that the issues lies there. debugout and log recursively call each other, which is preventing execution after the callsite of debugout.

Categories : Linux

Scope doesn't change when assigning one entity's function to another's
If I understood your question correctly - you can do: A = { name: 'Class A', sayMyName: function() { console.log(A.name); } }; Now it doesn't matter who's calling sayMyName - it'll always print Class A. Another option: A = { name: 'Class A', sayMyName: function(obj) { console.log(obj.name); } }; and then either define B like this: B = { name: 'Class B', sayMyName: function(){A.sayMyName(A);} }; B.sayMyName(); or call: B.sayMyName(A)

Categories : Javascript

How to add XML element A to element B which doesn't have A as a child element
Use an XML parser. XML::LibXML will do nicely here. Loop over all <trkpt> nodes: for my $node ( $xml->findnodes( '//trkpt') ) { ... } Use exists (or findnodes for older versions of XML::LibXML) to detect if the <time> node exists: if $node->exists( './time' ) { ... }

Categories : Perl

Limit scope of external css to only a specific element?
You may want to look at scoped styles; see http://css-tricks.com/saving-the-day-with-scoped-css/. The basic idea is <div> <style scoped> @import "scoped.css"; </style> </div> However, you are on the bleeding edge here in terms of browser support. See http://caniuse.com/style-scoped. One alternative would be to use an iframe.

Categories : HTML

Setting $scope.$watch on each element in an array
I think solution number 3 will work if you change the first $watch argument to: 'rental_dates['+pos+'].start_time' ($watch takes an angular expression as the first parameter, and pos isn't part of your scope). (While this should work, I think this won't be really efficient. Maybe you should look into updating both start_time and stop_time at the same time instead of watching for changes on all the start times.)

Categories : Angularjs

Add dynamically created element to the scope of Directive
You should avoid using jQuery outside of angular. However, AngularJS has a wrapper: angular.element('jquery selector here'); and the element parameter of linking function is already a jquery [lite] element, the one that matched the directive. Firstly, having a directive to assign a color is overkilling. If this is not a simplified example, you might want to reconsider it. Secondly, you're on the right track. You need to use the $compile service to make angular aware of the new directives. In the linking function of awesome you add an element to the DOM. You know that it will trigger a directive, angular doesn't. You compile it, now angular knows. See the example live Your awesome directive stays as is: test.directive("awesome", function () { return { replace: false, restrict: '

Categories : Jquery

Object slicing, vector element out of scope
You are creating the object in the stack and inside the scope of the if statement, once it goes out of that scope the object will no longer exist, and when the share_ptr is destroyed by the vector going out of the scope of the main function your program will crash since it will attempt to destroy an object that no longer exists. this: if (true) { CDerivedEvent derivedEvent = CDerivedEvent("1", "2", "3"); vec.emplace_back(&derivedEvent); } Should be: if (true) { CDerivedEvent* derivedEvent = new CDerivedEvent("1", "2", "3"); vec.emplace_back(derivedEvent); } It should work as you expect, but as Jhon Purdy said in the comment below, this would be more appropiate: int main() { std::vector<std::unique_ptr<CBaseEvent> > vec;

Categories : C++

Programmatic-ally bind DOM element to $scope
I would use a controller and scope for your common tempZone, use a service for data sharing (for the input), and $emit a 'bindToMe' event from one controller, to signal the other controller to stop listening to changes. Something in the lines of <div ng-app="myApp"> <div ng-controller="myCtrl"> {{foo}} <button ng-click="bindToMe()" /> </div> <div ng-controller="anotherCtrl"> {{foo}} <button ng-click="bindToMe()" /> </div> <!-- no its not outside of ng-app --> <div id="tempZone" ng-controller="tempZoneCtrl"> <input type="text" ng-model="myService.foo" /> </div> </div> and the controllers: angular.module('myApp') .controller('myCtrl', function($scope

Categories : Javascript

AngularJS : view variables in scope
I think it's Angulars dirty checking that fails due to eval is invoked in the global scope (I think). Try this: // replace this: eval("$scope.edit_alt_name" + $scope.alt_name_id + "=false;"); // with $scope['edit_alt_name' + $scope.alt_name_id] = false; Oh yeah, don't forget eval is evil (Why is using the JavaScript eval function a bad idea?) :) Here's an example: http://jsfiddle.net/fredrik/dZmgv/ The "form 2" won't hide since it uses eval.

Categories : Javascript

View not updating on $scope.foo change
You haven't shown the code for the Mail class so I can't be certain if the promise returned by Mail.send() is an Angular promise or not. However, you can wrap the call with $q.when() to help make sure Angular is aware when the promise is resolved: function MyController($scope, Mail, $q) { /* ... */ $scope.sendMail = function(type) { /* ... */ $q.when(Mail.create({some data})).then(function(result) { // result will be the resolved value $scope.surveyDiaryMailSent = 1; }); } }

Categories : Angularjs

Getting input from view to scope an index
You'll definitely want to do this with AJAX. For the specific thing you want to do (filtering/sorting a table) there's a javascript plugin I would recommend: DataTables (you'll want to check out the documentation on server-side processing) There's even a really nice tutorial to using it with rails in RailsCast #340

Categories : Ruby On Rails

Update $scope and reflect in view
The problem is you should be using a single controller for this. Here is an example of a controller that will display the correct menu depending on his connected scope variable. The value is set with AJAX or somewhere else in your code. CONTROLLER: function NavCtrl($scope, $rootScope){ $scope.showLogin = true; $scope.showLogout = false; $rootScope.$watch("connected", function() { if ($rootScope.connected) { $scope.showLogin = false; $scope.showLogin = true; } else { $scope.showLogin = true; $scope.showLogin = false; } }); } VIEW: <div id="navigation-bar" ng-controller="NavCtrl"> <li ng-show="showLogin"><a href="/login">Login</a></li> <li ng-show="showLogout

Categories : Authentication

Element does not get isolate scope if highest priority directive does not have one
Short answer yes. It doesn't make sense to have 2 directives require both an isolate scope AND a parent scope. The idea would be to think about how directive can work with each other. How would the parent scope directive work correctly if the scope it has is the isolate scope? I guess the angular team decided to not give a warning in this situation(could be a bug). if the lower priority requires a isolate scope that means it has a strict requirement of data from parent scopes if the higher priority doesn't require a scope that means it will inherit the parent scope and potentially use that data in the template. This is a catch 22 situation: It doesn't make sense that the non isolate directive use a isolate scope since it might depend on the fact that it's not isolate. At the same t

Categories : Angularjs

How do I connect between parent $scope, directive $scope and a modal $scope?
Like I said in the comment you can access the variables from the parent scope in the modal popups scope. HTML <div ng-app="app" id="app"> <div ng-controller="MainCtrl"> <label-select color="{{color}}"></label-select> <div class="flyout"> <ul> <li ng-click="setColor(color)" ng-repeat="color in colors">{{color}}</li> </ul> </div> </div> </div> JS var app = angular.module('app', []); app.controller('MainCtrl', function ($scope) { $scope.color = "#AAADDD"; $scope.colors = ["#AAA", "#BBB", "#CCC", "#DDD", "#EEE"]; $scope.setColor = function (color) { angular.element(".flyout").removeClass("show"); $scope.color = color;

Categories : Javascript

$scope is updated in view and not in controller for angularJs
For watching collections pass true as the third parameter to $watch, so it becomes: $scope.$watch('selectedCountries', function(...) {...}, true); This makes $digest step through the collection recursively instead of just doing a reference check. Alternatively if you have a deep structure and you only need to know if the bottom level has changed (i.e. added or removed elements) you can use $watchCollection instead of $watch. UPDATE: Working Plunker (works without deep $watch()): http://www.plnkr.co/edit/VaWBq9?p=preview

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.