w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to navigate between different nested ViewModels?
As I implement the INotifyPropertyChanged interface directly in my data classes, I don't have any nested view models, but I do have nested, or hierarchical data classes. In my base collection class, I have a property named CurrentItem of the same type as the items in the collection. When I bind one of these collections to the ItemsSource property of a collection control, I also bind the CurrentItem property to the SelectedItem property of the control. This essentially means that I always know which is the current item in each collection. If you implement one of these CurrentItem properties then you will always know which AppleItem or AppleNote is selected. You don't have to put these properties into collection classes... you could just add properties of the correct type to your view mod

Categories : C#

binding nested viewmodels: knockout
The submenu property contains no items. In this fiddle I just add a fake item and the resuting view shows a fakeSubMenu element. So I think you only have add items in the submenu property and it will work. This is what I done : ProductMenu= function(name, subProductsMenu1, selectedMenu) { var self= this; self.productname = ko.observable(name); self.submenu = ko.observableArray([{subMenuName: 'fakeSubMenuName'}]); self.selectedProductName = ko.observable(); }; I hope it helps. See fiddle

Categories : Knockout Js

Knockout binding nested viewmodels
Are you having issues with scope. How about: <div class="section"> <div data-bind="if: $root.general().Condition1 || $root.general().Condition2"> <!-- ko with: deal --> <label>Is this a New Client?</label> <input type=" radio " name="RadioGroup " id="Radio1 " value="true " data-bind="checkedRadioToBool: NewClient" /> <label for="radio1 ">Yes</label> <input type="radio " name="KSTProcurmentRadio " id="Radio2 " value="false " data-bind="checkedRadioToBool: NewClient " /> <label for="radio2 ">No</label> <!-- /ko --> </div> </div>

Categories : Javascript

Can't get my binding with nested viewModels to work with objects instead of strings
With this code it will work as excpected. HTML: <table> <tbody data-bind="foreach: inners"> <tr> <td> <p data-bind="text: selectedOption"></p> </td> <td> <select data-bind="options: $root.options, optionsText: 'name', optionsValue: 'value', value: selectedOption"></select> </td> </tr> </tbody> </table> javascript: var InnerModel = function(n){ var self = this; self.name = ko.observable(n); self.selectedOption = ko.observable(2); }; var OuterModel = function(){ var self = this; self.inners = new ko.observableArray([new InnerModel('

Categories : Javascript

Struts 1.1 nested and in combination
Use <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> and the code will look like <c:choose> <c:when test="${element.method1 == true}"> <c:choose> <c:when test="${element.method2 == true}"> <span style="color:green;"><c:out value="${element.prop1}/></span> </c:when> <c:otherwise> <span style="color:red;"><c:out value="${element.prop1}/></span> </c:otherwise> </c:choose> </c:when> <c:otherwise> <span style="color:black;"><c:out value="${element.prop1}/></span> </c:otherwise> </c:choose>

Categories : Java

Nested Views in Angular JS
You should get ui-router for that. I believe it's the only module that lets you do nested views. source code: https://github.com/angular-ui/ui-router instructions how to use: https://github.com/angular-ui/ui-router/wiki

Categories : Javascript

Inheritance and nested views in AngularJS
You should be able to enable protypal inheritance if you modify the source slightly. Open the file ./ui-router/src/viewDirective.js and you should find this near the top: var directive = { restrict: 'ECA', terminal: true, transclude: true, ... Add another line such that it reads: var directive = { restrict: 'ECA', terminal: true, transclude: true, scope: true, ... This should enable inheritance. I can't find a good direct source on this, but this you tube playlist is full of all sorts of angular goodness.

Categories : Javascript

AngularJS nested views & controllers
You need to connect your MyApp module (in its definition) with your MyApp.Admin modulelikes this: angular.module('MyApp', ["MyApp.Admin"]); But for a larger app, you might want to look at the UI-Router project instead...

Categories : Angularjs

Can Meteor handle nested views?
I love nesting templates. I get reliable results. I now program off a library of both templates and helper functions (usually for form elements) that compose html for me. HTML is a byproduct, and the files we call .html are really a javascript DSL. There are many S.O. issues raised about insertions into sorted lists giving people problems. I haven't had time to look. My rule of thumb: Meteor is (well) designed from the beginning to do this easily and reliably. So far the harder thing to solve was when I added an accordion from foundation, and a refresh of the document led to its initial state (being all closed, or one open). I had to put code in that saved the current section, and code to re-assert that in the rendered callback for the template that used it. Why not write a pro

Categories : Meteor

Backbone collection length always set to one with nested views
Looks like the problem is with duplicated id's in the collection. It is supposed to be a unique Identifier. Set the idAttribute inside the model and make sure, the id's for the 3 objects in question are different. var MemberModel = Backbone.Model.extend({ idAttribute: "_id" }); If your id is duplicated then the model will not be added to the model. If that does not work try setting the id Attribute explicitly _.each(response.users, function(item, index){ var member = new self.model(); member.set('_id', index);

Categories : Backbone Js

Backbone layoutmanager nested views error
I had this as my html: <div class="container"></div> Whereas in my backbone view, I was using el like this: el: "#container" Because it was an id selector and my html used class, backbone could never find the dom element. Changing the html to have an id of "container" fixed it

Categories : Backbone Js

Sails.js Nested Folders For Controllers, Models, and Views
I can understand the confusion here since your sails generate controller disciplineTracker/action seems to do something useful, when in fact it should probably just output an error because nested controllers are not supported in Sails at this time. So the short answer is, you can't do this.

Categories : Javascript

AngularJS ui-router doesn't work with nested views
You need to use the special ng-href attribute in place of the regular href if you're going to be interpolating expressions into the URL; otherwise the expression will be treated literally.

Categories : Javascript

AngularJS nested views not showing when using angular route segment
Do not use segment name, use segment index number. Example: <div class="pure-u-1" app-view-segment="0"></div> if you need nested route, use app-view-segment="1" and so on.

Categories : Javascript

How can I bind data from nested List<> objects to nested ListView controls?
You can bind the datasource of your inner list view to a property of the items bound to your outer listview. However, to do that the inner listview as to be in the itemtemplate of the outer listview. See the code below and note the DataSource='<%# Eval("Labels_color") %>' attribute for the inner list view. <asp:ListView ID="ListView_Orp_Results" runat="server" ItemPlaceholderID="itemPlaceholder"> <LayoutTemplate> <div id="outer_result_container"> <div id="itemPlaceholder" /> </div> </LayoutTemplate> <ItemTemplate> <div id="result_photo">...</div> <div id="result_category">...</div> <div id="result_detector">...</div> <div id="inner_result_container" runat="server"

Categories : Asp Net

JQuery selector for finding a nested span within a nested class is not working
I don't see any problem with your code at the moment, let's reformat it a bit: var tabs = $('.collapse').not('.in'); console.log("tabs.length: " + tabs.length); tabs.each(function () { var $this = $(this), thisErrors = $this.find('.field-validation-error'), thisId = '#' + $this.attr('id'); console.log("current tab ID: " + thisId); console.log("number of errors: " + thisErrors.length); if (thisErrors.length) { $(thisId).collapse('show'); } }); Or working fiddle: http://jsfiddle.net/Rq8y7/ Does it work now? And what's the debug message in console after you run above code?

Categories : Jquery

Parsing a flattly-written nested text template into a usable nested data structure for N levels
Replaces each ">" with a tab. Output is pretty much exactly as your brute force output. (file.txt is your template file as above) test = open("file.txt", "r") for line in test: print line.replace(">", " ") #print line

Categories : Python

How to insert nested lists (or nested block elements) into RichTextBlock?
Ok Ill start with silverlight. There was a TreeView Control in silverlight that would have exactly solved your problem. Link to tree view example But since we already know that winRt is a subset of API's these controls have been removed for metro app. More over microsofts design policy regarding the Type Of scenario you are mentioning has changed to : Semantic Zoom For Metro Apps So i advise if your app requirement is like that Either go with the richtextbox or use Grids with Rows and columns Which ever suits your coding best. One more way is to use third party library for tree structure . Syncfusion tree control Syncfusion has a tree control you can try out in the Demo. Even there are more third party tool but none are free not even he above one. Please Let me know if any more co

Categories : HTML

nested json with jQuery: create List of nested item
Your problem is that institut is an array containing a single object, so you can reference that single object using institut[0]. This will work: $.each(data.fakultaeten, function (key, value) { var mother = "<li id='first'>" + value.name + "<ul>"; $.each(value.institut[0], function (key1, value1) { alert(key1); }); }); Here is a working example

Categories : Jquery

MySQL - Reference main query in nested select (need to be nested)
This cannot work. SELECT clause is always evaluated at the end of the execution chain, @teamg_id variable will always be 0 in the nested subquery. Try this query, it is not tested (I can't see your data, playing whith sample data always helps), but probably it gives desired results. I commented out some parts and add one join condition. /* SET @teamg_id := 0; */ SELECT /* @teamg_id := player.team_id, */ player.team_id AS player_team, event.local_team_id AS local_team, event.visitor_team_id AS visitor_team, action.unique_id AS action_id, action.player_id AS player_id, player.name AS player_name, playerindex.rank AS player_pos, playerindex.ses_var_nest AS ses_var_nest FROM er_players player

Categories : Mysql

How Can I Convert Nested YAML to nested Arrays and OpenStructs in Ruby
There is the solution (https://github.com/jsuchal/hashugar) i often use. opts = Hashugar.new({:a => 1, 'b' => {:c => 2, :d => [3, 4, {:e => 5}]}}) But you also need to do: opts.b.d.last.e I do not understand how do you want to name array's getters. As Arup Rakshit sayed: give us yaml example and expected output or behavior.

Categories : Ruby

Avoiding nested each loops when handling nested JSON data
JSON is "just" javascript object literals. You can skip the jQuery call, and just reference the objects and arrays directly after you parse it. obj.custom_sql_rule[0].something_else[0]; of course, your JSON is a bit oddly-formed. If at all possible, don't arbitrarily mix objects {} and arrays [] . Use the latter when you have lists of identical objects or primitive data, and the former when you have named properties. And once you have a valid javascript object, you can just iterate through its properties. for(var sqlProp in jsonObj) { if(jsonObj[sqlProp].error) { errorsContainer.append("<div>" + jsonObj[sqlProp].error + "</div>"); } }

Categories : Javascript

How do you organize your Models/Views/ViewModels in WPF
I separated them into different projects then broke it down from there. Basically M project, VM project, and then the View as the main project. Though eventually V & VM became more tightly coupled.

Categories : C#

Views, ViewModels, "WindowViewModels" ...what am I missing here?
In my opinion, too many. Architecture should be flexible and you might not keep sticking to one of technique, like IOC, when you smell something. On one hand I did not see the benefit of ISomeDomainModelEntityViewModel, ISomeWindowViewModel and IObservableCollection, there is only one class for each interface, except DI and on the other hand, interface is not essential for DI. I think you might take a look Prism examples to see how they construct ViewModel with DI and when to use interfaces. Usually, if you want to use DI to construct a ViewModel, all dependencies of the ViewModel are services, defined in interface and use IOC to resolve these services. Since these services like have external dependencies so that mocking these interfaces to test is easy. However, most of ViewModel does no

Categories : C#

nested attributes, passing current_user.id to nested model
'current_user' is a devise helper method. it can be accessed in controllers n views directly. if i m not wrong, only the new answer should have the current_user.id Old answers should not be updated. u can do this as f.fields_for :answers, @question.answers.build do |a| a.hidden_field :user_id, :value => current_user.id a.submit

Categories : Ruby On Rails

Idiomatic Emberjs for nested routes but non-nested templates
You could define the parent template to just display the outlet and have an index route which will get displayed inside that. Then for the nested resource you can do the same thing. <script type="text/x-handlebars" data-template-name="user"> {{outlet}} </script> <script type="text/x-handlebars" data-template-name="user/index"> <h2>user/index</h2> </script> <script type="text/x-handlebars" data-template-name="posts"> {{outlet}} </script> <script type="text/x-handlebars" data-template-name="posts/index"> <h2>posts/index</h2> </script> That way it won't be a master/detail. The router would be: App.Router.map(function() { this.resource('user', function() { this.resource('posts', function() { }); });

Categories : Ember Js

PHP - Find nested array1 in nested array2
If I understand correctly what you are trying to achieve, you could do it like this (see comments in code): /* Process one needle (look into haystack and modify it accordingly) */ function processNeedle(&$haystack, $needle) { $needleKeys = array_keys($needle); $needleValues = array_values($needle); $needleLen = count($needle); $haystackLen = count($haystack); /* Find indexes where a match begins */ $matches = array(); for ($i = 0; $i < ($haystackLen - $needleLen + 1); $i++) { $match = true; for ($j = 0; $j < $needleLen; $j++) { if ($haystack[$i + $j]["v1"] != $needleKeys[$j]) { $match = false; break; } } if ($match) { $matches[] = $i;

Categories : PHP

Nested ajax with nested rendered attribute in JSF
It is most likely what your ManagedBean is not in ViewScoped or SessionScoped. When you post back to the bean, you are loosing rendered states. I suggest to change for the ViewScoped one. Not related : You should remove the action attribute from the h:form since JSF override it.

Categories : JSF

how to remove nested entry in a nested map using dot notation
You could write your own method to do this, although you'd be likely to have to resort to a fair amount of casting. You'd probably just split on dots, then keep calling get (and remembering the result for the next step) until you got to the last part, at which point you'd call remove instead... remembering to check for a null return from get at every step. I don't know of anything built into a third party library to do this - which isn't to say it's nowhere, of course.

Categories : Java

How to configure Durandal.js to have multiple areas with views and viewmodels in same folder?
You can have any folder structure your heart desires. Durandal does not impose any folder structure on your application but it does have a default convention which is completely overridable. If you are using Durandals router then you will want to look into how to configure it to find modules. There are many ways of doing this, I prefer to create my own convention by overriding the router.autoConvertRouteToModuleId. If you are not using the router plugin then you will have to manage the uris for your modules yourself and this is done by following requirejs' convention and using this convention along w/ durandals composition module. Also, you can override how it finds the views to bind to your modules by overriding the viewlocators convention. Durandal provides an very simplistic way

Categories : Misc

Jenkins: Creating Jenkins Nested/ListView Views programatically
There is a great job-dsl plugin to automate a process of job and view creation. Checkout example of Nested View dsl. We used it for Continuous Delivery, and it works pretty well! You may start here.

Categories : Jenkins

AngularJs UI-Router Nested states with side-by-side views
Can you try one of the following .state('side-by-side.item', {url: /side-by-side/{itemId}/{pageId}, views: { 'detailPage@side-by-side.item': {templateUrl: 'detailPage.html', controller: 'PageController'} }}); or .state('side-by-side.item', {url: /side-by-side/{itemId}/{pageId}, views: { 'detailPage@side-by-side': {templateUrl: 'detailPage.html', controller: 'PageController'} }});

Categories : Angularjs

PHP: Pull values foreach() nested array, run function, return a 2nd level nested array
foreach ($array as $key => $value){ $array[$key]['restaurants'] = work($value['id'],$value['name']); } function work($id,$name){ $results = array(); ///process data return $results; }

Categories : PHP

How to populate data into a nested table in Oracle when the nested table is within a record type
This document: http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/composites.htm#CIHIEBJC describes how to work with collection types in PL/SQL: Basic example: DECLARE TYPE N_TYPE IS TABLE OF VARCHAR2(350); TYPE TYPE1 IS RECORD ( FIELD_1 VARCHAR2(100) , FIELD_2 VARCHAR2(30) , FIELD_3 N_TYPE); v_n n_type; v_type1 type1; BEGIN v_n := n_type(); -- initialize an empty collection v_n.extend( 3 ); -- add 3 elements to the table v_n( 1 ) := 'First string '; v_n( 2 ) := 'Second string '; v_n( 3 ) := 'Third string '; v_n.extend; -- add 1 element at the end of the table v_n( v_n.last ) := 'Next string'; --assign the table to the field_3 of the record v_type1.field_3 := v_n; -- check values FOR i in v_typ

Categories : Oracle

Nested Repeater Puzzle: Using data returned from (outer) query, in a nested query
Couple of things that should be fixed here: The error "Server tag not well formed" was due to missed double quote after ConnectionString attribute. Remember that everything that goes inside <%# %> must be a valid C# code, which means that that if your are using a string - you should enclose it into double quotes. Typical pattern for quotes here is AttributeName='<%# Eval("Property")%>'. That was not the case in the SelectCommand value. When you need to manipulate with both literals and bound data, like in the select query here, it is better to enclose the whole expression in the servlet tags and perform necessary transformations inside. All in all, here is the result: <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSourceGrantCategories"> <Ite

Categories : C#

Creating a new nested list element that is a combination of two existing nested list elements (in R)
Here are your for loops using replicate (Note that the expression value for each replicate is the same expression you have in the assignment portion of your for loop) ## This is your inner for-loop, using replicate inds <- seq(begin, end, 10) datas <- replicate(length(inds), list('mean'=vector(mode='list',length=12),'sd'=vector(mode='list',length=12)) , simplify=FALSE) names(datas) <- inds # This is your outer loop tardis2 <- replicate(length(dataLayers), list('longName'='timeLord','units'='theDr','data'=datas) , simplify=FALSE) names(tardis2) <- dataLayers # Compare Results identical(tardis2, tardis) # [1] TRUE However, I'm not sure if lists are relaly the best structure for this. Have you considered data.frames?

Categories : R

sorting tr elements with nested tables, hide nested tbody while sorting
jsFiddle Demo At first I'd like to say that it's clear you really put effort in finding a solution on your own so it really made me want to help. The problem is that if you hide parts of the element after it begins to be dragged, the size isn't recalculated. The solution is like in the code you've linked. You have to catch a more preliminary event (like mousedown) and hide it before the dragging begins. $('tr.draggable_item').mousedown(function() { $(this).find("tbody").hide(); }); $('tr.draggable_item').mouseup(function() { $(this).find("tbody").show(); });

Categories : Jquery

Php parse xml (multiple nested <> ). With one nested <> works, - multiple does not work
The reason is because you are accessing the $currencies like its the root element. You could load the file and reference currencies with $xmlDoc->currencies and it should work. Please try the following: $xmlDoc = simplexml_load_file('__joomla.xml'); /**/ $cdate=$xmlDoc->Date; echo "<time>". $cdate. "</time><br>"; foreach ($xmlDoc->Currencies->Currency as $currency): $id=$currency->ID; $units=$currency->Units; $rate=$currency->Rate; echo " <div class='id'>". $id. "</div> <div class='units'>". $units. "</div> <div class='rate'>". $rate. "</div> "; endforeach; Update: Updated $xmlDoc->Currencies to $xmlDoc->Currencies->Currency, as we want to loop through the Currencies' children.

Categories : PHP

Why do nested classes in java differ from nested classes in C# in the following aspect?
The problem is that the way you have declared classes in Java, the inner class has an implicit reference to an instance of the outer class. Hence the error message: "error: an enclosing instance that contains outside.inside is required". This means you need to: Outside out = new Outside(); Outside.Inside in = out.new Inside(); In general, this pattern is used in Java in situations where it makes no sense for an instance of the inner class to exist without an instance of the outer class; and note that the inner class instance will have access to all of the outer class instance's variables, even private ones. But in general, such classes are generally private. In order for this to disappear, you must make the inner class static. And then you will be able to do: Outside.Inside in = new O

Categories : C#

One ViewModel containing a collection of ViewModels, different Views depending on value of ViewModel property
Don't to it in the view, instead expose different collections on your ViewModels according to what you need to filter. This can be done either as known collections, e.g. public ObservableCollection<MonitoredItemViewModel> ItemsWhereFooIsBar ... public ObservableCollection<MonitoredItemViewModel> ItemsWhereFooIsntBar ... or you could do it more generically to return filtered collections on demand public ObservableCollection<MonitoredItemViewModel> GetItems(Func<DataValue, bool> matches) { //Filter collection with return ... allItems.Where(x=>matches(x))... ; } and call via GetItems(x=>x.Foo == Bar) The problem you are going to have is when the items change and should switch from collection to collection. If you were using ReactiveUI this woul

Categories : C#



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