w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Same property in two different tabs (divs). Property is null when tab 2 is posted to action method
It sounds like you have both FirstName input fields inside the same form. Something like: <form> <div id="tab1"> @Html.EditorFor(m => m.FirstName) </div> <div id="tab2"> @Html.EditorFor(m => m.FirstName) </div> </form> When you post this, the form is submitted as: FirstName=valueFromField01&FirstName=valueFromField02 From the behavior you are describing, it seems that once the model binder sets the FirstName field in your MyViewModel, it ignores the second one (but I'm not really sure about that). Solutions: Rather than have a form with different tabs inside of it, have a form inside each tab. This will ensure you only have one FirstName inside a form. Update the model so that you get both fields. You would need to

Categories : Asp Net Mvc

Spring MVC/Hibernate - NullValueInNestedPathException, Invalid property, value of nested property is null?
I found out what was wrong: It seems that I set the default value of the column for the new property to null! I hope that others that are getting this same error try this solution out. -__-! Thanks to drurenia taking some interest! :D

Categories : Hibernate

WPF binding update notification for nested property when parent property changes
I'm not an WPF expert, but I think it's because you've chosen the wrong path. <TextBlock Text="{Binding Path=MyCarProperty, Value=Manufacturer}" /> update: <TextBlock Text="{Binding Source=MyCarProperty, Path=Manufacturer}" />

Categories : C#

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

count all divs until the end of the dom with same class after a certain class(inc nested divs)?
I think this does what you want: $('.date').on('click', function () { var divs = $('div'); var $findchckin = $('.class1'); var index = divs.index($findchckin); divs.filter(':gt(' + index + ').date').addClass('aftercheckin'); }); FIDDLE If your .daterows are within a container on the real page, you would probably want to use that container as the context for divs, for performance.

Categories : Javascript

sqlalchemy nested inheritance / polymorphic relationships
You definitely can do this. The code below is using the declarative_base, but shows the model setup which works. D class is both a parent and a child using class inheritance. However, the polymorphic_identity is stored only on the top level. Make sure you have all proper foreign keys and class inheritances set up. *Note: you example defines type_id as Numeric, however the values seem to be Strings.* Base = declarative_base(cls=_BaseMixin) Base.query = session.query_property() class BaseModel(Base): __tablename__ = 'entities' id = Column(Integer, primary_key=True) #type_id = Column(Integer, nullable=False) type_id = Column(String, nullable=False) __mapper_args__ = { 'polymorphic_identity': 'entity', 'polymorphic_on':type_id, 'with_polymorphic':

Categories : Python

get a property's private setter within inheritance
so...why? As far as A is concerned, Bar is read-only - you can't call the setter from A, so it does make sense that there's no setter when you ask for the property with respect to A. One alternative is to use binding flags to only ask for declared properties - and walk your way up the inheritance chain until you find the actual property declaration. It's a little bit odd that you have to do this, but it does make a certain amount of sense, as the property really is different depending on whether you're coming to it from the context of the declaring class or not. I'm surprised by this behaviour - but not shocked.

Categories : C#

Positioning nested divs with CSS
If you want this to scroll you would need to add an overflow attribute to the div that is to serve as the parent. For example adding overflow: auto; to the #list2 causes all of the children to scroll within it.

Categories : Javascript

Hiding certain DIVs (not nested unfortunately)
Try $('div[id^=TITLE]').click(function(){ $(this).nextUntil('div[id^=TITLE]').toggle(); }) Demo: Fiddle The underlying logic is simple - Make divs with id starting with TITLE clickable by adding a click handler - to do this attribute starts with selector is used. Then find all divs between the clicked element and the next element with id starting with TITLE - this is done using .nextUntil() traversal method. Then .toggle() is used to hide/show the element

Categories : Javascript

even odd selection from nested divs
Rather than select the even/odd .article elements, you need to select the even/odd .section elements. .section:nth-child(even) > .article { /* Your css here */ } Fiddle: http://jsfiddle.net/jakelauer/4PMbS/

Categories : CSS

RWD: Center nested DIVs
The layout hugs the right side of the page because you have not set a width-value to the "homewrapper" div. The question How to center a div in a div - horizontally? covers this problem in more detail. This could be fixed by giving it a total width value like so: <div id="homewrapper" style="width: 744px; margin: 0 auto;"> However there are some other issues with your code. I don't know if you already are aware of this, but you say that you are new to CSS, so I'll include it anyway. Writing all of your styling directly in the style attribute of a html tag is considered very bad style and counteracts the benefits of separating content and presentation. You should instead include it in a separate style sheet and include it in the header of the html-document. w3schools will show yo

Categories : CSS

Rails/Mongoid accepting nested attributes for models with inheritance
The problem was in the form, it should be user_form.fields_for :cards instead of :health_cards Below is the corrected version = form_for @user do |user_form| = user_form.fields_for :cards, @health_card do |hc_form| = hc_form.text_field :number = user_form.submit 'Next'

Categories : Ruby On Rails

jquery img load and nested divs
You create the lis in the image load callback so then add the div to the li there. $('<img src="' + showpic(item[3]) + '" class="newsImage">') .load(function(){ $(this) .appendTo($('#theNews')) .wrap($('<li>', {"class": "newsItem"})) .wrap('<div class="st-col2">') .closest('li') .append($('<div>', {"class": "st-col1"})); }); });

Categories : Jquery

Two nested divs are able to expand but not the parent
Use overflow to parent element, because your child divs floated: <div style="overflow: hidden; background-color:#000; color:#FFFFFF; width:444px; height: auto;"> or use instead of float:left; for childs display: inline-block;

Categories : CSS

Simple CSS Nested Divs issue
Try using css attribute overflow for your header. I'm not exactly sure if this is what were you were looking for, but this will make the blue box contain a scrollbar inside it if the red box is bigger. #layout-header { width:100%; height:126px; background-color:blue; overflow:auto; }

Categories : CSS

jQuery animation on nested divs
$('#yearscontent div') selects all divs below #yearscontent. If you use $('#yearscontent > div'), it will select only the direct descendant of #yearscontent. Also, element id's need to be unique, so you'll need to rework your html/script a little bit. I would use classes instead. Updated fiddle: http://jsfiddle.net/N5euG/ Update to answer your question in the comments Consider this html: <div id="topDiv"> <div id="div1"> <div id="div2"> <div id="div3"></div> </div> </div> </div> <div id="div4"></div> #topDiv div will select #div1, #div2, and #div3. Any divs within #topdiv #topDiv > div will select only #div1. Just the direct descendant of #topDiv.

Categories : Javascript

Nested DIVs - Prevent inner DIV from refresh
You could always select what elements to refresh, but doing the opposite and leaving elements out will be more complicated, especially if those elements are nested within elements that should be refreshed etc. var to_refresh = ['id1', 'id2', 'id3']; var auto_refresh = setInterval(function () { $.each(to_refresh, function(_,id) { $('#'+id).load('ajax.php #'+id).fadeIn("slow"); }); }, 1000);

Categories : Jquery

Select all divs but not those in nested in specific div
You probably need descendant insted of direct child so remove > from selector. Change .not('.filter_list_1_container > div') To .not('.filter_list_1_container div') Your code would be. $(function() { var zIndexNumber = 1000; $('div').not('.filter_list_1_container div').each(function() { $(this).css('zIndex', zIndexNumber); zIndexNumber -= 10; }); });

Categories : Javascript

HTML: one of two nested DIVs appears outside of parent DIV
Use position property of css <div style="background:red; position:relative; height:100%"> <div style="background:green; height:100%;position:absolute; top:0px;left:0px; width:50px;"> </div> <div style="background:yellow;position:absolute;left:50px;top:0px; height:100%;width:100%;"> </div> </div> DEMO OR Use float property of CSS <div style="background:red; height:100%"> <div style="background:green; height:100%;float:left;width:50px;"> </div> <div style="background:yellow; height:100%;"> </div> </div> DEMO

Categories : HTML

How to sort nested divs depending upon content
but this code creates a new List of ordered H2s without the divs. That's because you are sorting h2 elements and not the div elements: jQuery("#txm_left_column > div").sort(function(a, b) { var upA = jQuery('> h2', a).text().toUpperCase(); var upB = jQuery('> h2', b).text().toUpperCase(); // ... }).appendTo(selector);

Categories : Javascript

CSS Divs not displaying height property
You are presenting data in a tabular format. Use a <table>. When that CSS tutorial you read said tables are some terrible evil thing, they meant that using tables for presentation/layout is terrible/evil. When presenting tabular data, it is semantically accurate to use a <table>.

Categories : HTML

Rails: Nested form with STI inheritance informing forms, how to make work with AJAX?
Well, I still don't know if this is the easiest, or DRYist way to do it, but I ended up putting the whole form in the partial, and then just not bothering with nested forms. This worked just fine with the AJAX solution. It makes me sad to repeat the form elements they have in common every time, but it's worth it for the AJAX functionality. I'll try making a bit more DRY, it occurs to me I could try making the subclass partial not need a form, but it could still call a super class form partial to insert the elements each subclass has in common.

Categories : Ruby On Rails

Rails nested attributes form for polymorphic/single table inheritance associations
This is one of those situations where directly mapping a form to a model is not ideal. I think a user-filled form map and a persistence model instance are two very distinct concepts. You might try subclassing Vehicle into a class that is used to accept form data. Then mix in all the extra code you need to handle what is specific to the form. This way, you keep your Vehicle model clean. You can also override methods in VehicleFormModel to work like a factory, to build the correct instance when the object is being created. In your controller, instantiate a VehicleFormModel instead of a Vehicle. class VehicleFormModel < Vehicle include Car::FormModel include Truck::FormModel def self.build # Use a form field to handle specifics for each type, # delegating to the mixed in F

Categories : Ruby On Rails

how to horizontally align nested divs? possibly responsively?
http://learnlayout.com/ Check this out. This is the most comprehensive basic css layout guide I've ever come across. You must get your answer there.

Categories : CSS

jquery swap nested divs content in container
attach the following function to the click event of your button : function handler() { $('.element').each(function(){ var temp = $(this).find('.nameP').text(); $(this).find('.nameP').text($(this).find('.nameE').text()); $(this).find('.nameE').text(temp); }); }

Categories : Jquery

Nested divs, overflow scroll on the outer one, inner one is truncated
I only tried this in Chrome, but it worked: .inner { background-color: red; white-space: nowrap; display: table-row; } http://jsfiddle.net/tGkdn/5/ I almost just gave you a javascript fix, which I'll post here just in case that is not cross-browser. var inner = document.querySelectorAll('.inner'); for ( var i = 0, l = inner.length; i < l; ++i ) { inner[i].style.width = inner[i].parentNode.scrollWidth + 'px'; }

Categories : CSS

Create Nested Drag and Drop divs with jquery-ui
It doesn't work because on document ready, $('.dest .parent') and $('.dest .parent .child1') don't match anything, so droppables are not initialized for those selectors. You have to initialize droppable when parent is dropped on .dest (and bind droppable only on the created .parent element) $('.dest').droppable({ accept: '.parent', drop: function (event, ui) { $newElt = $('<div class="parent box"></div>'); $newElt.appendTo(this); $newElt.droppable({...}); } }); I edited your fiddle: You can see the full demo here EDIT: If you want to check if only one .child2 exists when dropping on .child1, you can put your .append() inside an if/else structure, and use the .find() function, combined to length (which retrieve the number of element

Categories : Jquery

How to remove the style attribute from li tag nested within two divs via Jquery
Simply you can do $("li").removeAttr("style"); //removes all li style attributes. If li in a div $('.garage li').removeAttr("style"); // remove specifically inside a div.

Categories : Jquery

understanding inline-block divs and its "margin" css property
I think I figured out how it works. here you can find an example I tried to write for you from scratch. The image has been replaced by a div, but since they are both displayed as inline-block, the last one is convenient for changing heights and play with it. Let me say it's quite useful if you don't want to use jquery to heavily manipulate all your DOM! Crop and centering just in a bunch of css rulesets.

Categories : CSS

List orderby nested property
Try this way: var webinarsWithOrderedSessions = (from x in mappedWebinars from y in x.TimeZones from s in y.Session orderby s.StartTime select x).ToList();

Categories : C#

How to handle nested property list
You are first retrieving a Dictionary from the plist and then writing an Array. One of the 2 is wrong. Based on that you want to maybe try something like this: NSMutableArray *fruitPlist = [[NSMutableArray alloc] initWithContentsOfFile:finalPath]; NSDictionary *newFruit; for (NSDictionary *fruit in fruitPlist) { if ([fruit objectForKey:fruitName]) newFruit = fruit; } if (!newFruit) { newFruit = [[NSDictionary alloc] init]; [fruitPlist addObject:newFruit]; } else { NSInteger index = [fruitPlist indexOfObject:newFruit]; // modify newFruit as you wish [fruitPlist replaceObjectAtIndex:index withObject:newFruit]; } [fruitPlist writeToFile:finalPath atomically:YES];

Categories : IOS

How to access the Property value of nested class in c#
Since everything involved is public, you can access this value outside the assembly as follows: public class SomeExternalClass { public void SomeMethod() { string val = a.b.result; } }

Categories : C#

how to reach a property in nested objects easily?
Have you tried your solution? It causes a syntax error. Obj isn't defined while you're trying to define it, and even if it was you wouldn't get the latest value of obj, because you're trying to set it as the current value of the array at runtime. see here: syntax error example You want to make that property a function so that a user can get the current total when they access the function. Like this: totalPoint: function(){ return calc(Obj.a.state.teams.starter.handPoints) } working example If you want to shorten the reference you can alias some part of it. For instance totalPoint: function(){ var myStarter = Obj.a.state.teams.starter; return calc(myStarter.handPoints) }

Categories : Javascript

How to query nested property from parent entity
use Any() instead of your nested Where _seasonRepository.Query() .Where(s => s.Teams .Any(t => t.TeamMembers .Any(tm => tm.Player.PlayerId == player.PlayerId))); or Dmitry's version player.TeamMembers.Select(tm => tm.Team.Season).Distinct();

Categories : C#

Get a callback when a deeply nested property changes, with a WPF binding
If your 'Nested' is INotifyPropertyChanged implemented you can subscribe to its PropertyChanged event in viewmodel. You will get notification when ever thr is change in any proprty including Object

Categories : C#

RelativeSource works on (nested) sub-property, while ElementName does not
Ok, finally, I found the problem! After adding diag:PresentationTraceSources.TraceLevel=High to binding defs (very useful thing btw, in the absence of normal ol' step-by-step debugging), I saw the following in the output: System.Windows.Data Warning: 108 : BindingExpression (hash=54116930): At level 0 - for MainWindow.SomeClassProp found accessor RuntimePropertyInfo(SomeClassProp) System.Windows.Data Warning: 104 : BindingExpression (hash=54116930): Replace item at level 0 with MainWindow (hash=47283970), using accessor RuntimePropertyInfo(SomeClassProp) System.Windows.Data Warning: 101 : BindingExpression (hash=54116930): GetValue at level 0 from MainWindow (hash=47283970) using RuntimePropertyInfo(SomeClassProp): System.Windows.Data Warning: 106 : BindingExpression (hash=54116930)

Categories : C#

Get Object nested property using dot separated string
You can roll your own, assuming object is a dynamic object : public function getObjectProperty(object:Object, property:String):Object { var parts:Array = property.split("."); if(parts && parts.length == 2 && object && object[parts[0]] && object[parts[0]][parts[1]]) { return object[parts[0]][parts[1]]; } return null; } Here is another one that will work with different strings : private function test(e:Event = null):void { var obj:Object = { "child": { "property":1 }, "anotherproperty": 2 }; var test1:Object = getObjectProperty(obj, "anotherproperty"); var test2:Object = getObjectProperty(obj, "child.property"); } public function getObjectProperty(object:Object, prope

Categories : Actionscript

Select nested element text property
var theText = $('#rightnow > h3.reallynow > span').text(); As you said you may have other .reallynow elements, I've tried to make it as specific as possible, using the ID, the span's parent (h3) and the direct child selector. This is as foolproof as possible without knowing all your markup.

Categories : Jquery

counts days inbetween then add class to those days with nested divs?
You mean something like this? $(function(){ var $class1 = $('.class1'); var $class2 = $('.class2'); var $afterClass1 = $class1.nextAll('.test'); var $beforeClass2 = $class2.prevAll('.test'); var count = $afterClass1.length + $beforeClass2.length; $('.count').html(count); }); http://jsfiddle.net/SAsty/ Edit: Better visualization http://jsfiddle.net/SAsty/3/ Edit 2: Do something like: var $allBetween = $afterClass1.add($beforeClass2); $allBetween.addClass('between');

Categories : Javascript

WPF,MVVM Binding ViewModel-Property to nested UserControl
Likely you have a collection of ViewModels where each of them will be a DataContext for a certain Tab. Then this ViewModel should have another collection that can be used as DataContext for your Grid or Tree.

Categories : Wpf



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