w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Button Click Selects all checkboxes in DataGrid Rows in WPF
In the button handlers for your buttons you need the following code: foreach (var item in dataSource) { item.Checked = true; // or false for ClearAll } You change the values in the source data and the UI will update to reflect that change.

Categories : Wpf

Dynamically create checkboxes and calculate total depending on checkboxes ticked
The simpliest way is to use ko.mapping.fromJS Take a look at this fiddle var addonsData = [{ sku: 201, name: "addon A", price: 1 }, { sku: 201, name: "addon B", price: 2 }, { sku: 201, name: "addon C", price: 10 }]; function viewModel(ad) { var self = this; var mapping = { create: function (item) { item.data.selected = ko.observable(); return item.data; } }; this.addons = ko.mapping.fromJS(ad, mapping); this.selectedItems = ko.computed(function () { return ko.utils.arrayFilter(self.addons(), function (item) { return item.selected(); }); }); this.total = ko.computed(function () { return self.selectedItems().length; }); this.totalPrice =

Categories : Knockout Js

extjs 4.1.0 Checkcolumn with grouping plagin - how to make all checkboxes in a group (not grouped checkboxes) to be checked or unchecked together?
For requirement #1, the checkchange listener is indeed the right place to implement it. To get all the records in the group, you need to grab a reference to the grid's store, and then use its query method, with your grouping field, and the value in the checked record. Here's an example: checkchange: function(col, index, checked) { var grid = col.up('tablepanel'), store = grid.getStore(), record = store.getAt(index), group = record.get('group'), // returns a MixedCollection (not a simple array) groupRecords = store.query('group', group); // apply the same check status to all the group groupRecords.each(function(record) { record.set('checked', checked); }); } For your second requirement, I don't really understand when you

Categories : Extjs

Check 2 checkboxes with one click on dynamically made list of checkboxes
Give the price inputs a class of "price" or something similar, and give the name inputs a class of "name" or somthing similar. Then bind the events using the class selector, and find the corresponding checkbox using next('.price') or previous('.name')

Categories : Javascript

How to get value of different checkboxes and calculate value of those checked checkboxes and show in the input field?
You would need to iterate over the cheboxes. And change event makes more sense when you are talking in terms of checkboxes.. Use on to attach events instead of bind $(document).ready(function () { // cache the inputs and bind the events var $inputs = $('input[type="checkbox"]') $inputs.on('change', function () { var sum = 0; $inputs.each(function() { // iterate and add it to sum only if checked if(this.checked) sum += parseInt(this.value); }); $("#price").val(sum); }); }); Check Fiddle

Categories : Javascript

If I have multiple checkboxes in a form how can I pass all the checkboxes that are currently checked?
function getCheckedBoxes(chkboxName) { var checkboxes = document.getElementsByName(chkboxName); var checkboxesChecked = []; // loop over them all for (var i=0; i<checkboxes.length; i++) { // And stick the checked ones onto an array... if (checkboxes[i].checked) { checkboxesChecked.push(checkboxes[i]); } } // Return the array if it is non-empty, or null return checkboxesChecked.length > 0 ? checkboxesChecked : null; } // Call as var checkedBoxes = getCheckedBoxes("mycheckboxes"); Live DEMO Also try this one $("#clickme").click(function(e){ var selected = $("#checkboxes input:checked").map(function(i,el){return el.name;}).get(); alert("selected = [" + selected + "] as string = "" + selected.join(";") + """); });

Categories : Javascript

DataGrid edition 'EditItem' is not allowed for this view` when bound to a WPF DataGrid
I tried this and the problem is that you have initialized your Level2 collection as Hashset<>. IEditableCollectionView.EditItem() throws this error while trying to update item in Hashset<>. I initialized the collection as List<> and it was working fine. I am not sure why it is not able to update item in hashset, need to look deeper into it. But changing the Hashset<> to List<> will fix this error. Hope it helps Thanks

Categories : C#

Silverlight Datagrid scrolling, DataGrid fires RowLoading event
The RowLoading event is fired because rows are virtualized. With virtualization, rows are created (and loaded) only when they are visible on screen. So every time you scroll down or up a new row is created, loaded and the RowLoading event fired. To disable the virtualization you can try to set this property: VirtualizingStackPanel.VirtualizationMode="Standard" Be aware that this can slow down the performance of your grid if you have a lot of rows.

Categories : Database

Binding ComboBoxColumn to collection from DataGrid's ItemsSource in WPF DataGrid
MSDN: DataGridComboboxColumns says: To populate the drop-down list, first set the ItemsSource property for the ComboBox by using one of the following options: A static resource. For more information, see StaticResource Markup Extension. An x:Static code entity. For more information, see x:Static Markup Extension. An inline collection of ComboBoxItem types. So basically to just bind to data object`s collection property it`s better to use DataGridTemplateColumn: <DataGridTemplateColumn Header="Log"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <ComboBox ItemsSource="{Binding log}" /> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> This type of c

Categories : Wpf

Copy selected row from datagrid at the end of datagrid
For Datagridview Databound you have to commit additional record to datasource (table) So, you have to do "INSERT INTO mytable ( fields here ... ) VALUES ( values here ..)" then to refresh your datagridview .. dt2.datasource = mytable ADDED : For your code ... try change like this insert_cmd.Parameters.AddWithValue("@Name", .item("Name")) insert_cmd.Parameters.AddWithValue("@Age", .item("Age"))

Categories : Sql Server

Validating A WPF Datagrid Against Data From Another Datagrid
From Microsoft official WPF course materials: ValidationRules are only to be used as simple validations (For instance Required fields, numeric formats, etc). If you need advanced / complex Business Rules validation, you should either implement IDataErrorInfo or create your own validation mechanism (that's what I did and it works like a charm)

Categories : C#

Master-Detail: On row click in master (DataGrid), display details (DataGrid)
If you searched online, you would have found a number of answers. For example, please take a look at the following articles: WPF Master Details MVVM Application Implementing a simple Master-Detail scenario for WPF in MVVM MVVM - Master Detail

Categories : Wpf

How can I link two checkboxes to one cell so that IFF two checkboxes are false, the cell is changed
The problem with having the code in "Calculate", is that you can't determine whether the user clicked on a checkbox or edited the cell contents. To get rid of this proble, I would suggest that you have distinct code for each of the events: If user clicks on a checkbox, you can use the Checkbox##_Click event, and place the checking code there. (Your CheckBoxes need to be ActiveX and not Form controls) If user changes the value in the worksheet, use the "Worksheet_Calculate" to check the corresponding checkbox. You can rely on the fact that Excel/VBA will always process the events in the same order. Now, one sad thing about CheckBoxes : You can access them throug the OLEObjects collection of the Sheet (ActiveSheet.OLEOBjects("CheckBox1") but you can't assign a value. So looping and us

Categories : Excel

Traverse from one UL to another UL with .next
How about: Mousetrap.bind('right', function() { if ($('li.active').is(':last-child')) obj = $('li.active').parents('ul').next('ul').find('li').first(); else obj = $('li.active').next(); obj.click(); });

Categories : Javascript

Copying data from a datagrid view to a new form with a new datagrid view VB
"Error 1 Reference to a non-shared member requires an object reference." As this message says: You need a instance of form2 - object of type form2created with New sub, which you created inside of BTN_Next_Click. But local variable frm_PI_01 can be used only inside of that function. With name of class form2 you can used only Shared member or functions/subs MSDN Shared members in VB My opinion if you need transfer some information/variables from form to another then in your case(when you transfer data only once when creating form) use a parameters in form constructors. Add another parameter to you form3 constructor. For example reference of your datagridview(this is may be not good practice referenced controls to another form, better create some variable with needed data and reference th

Categories : Vb.Net

traverse over all of a label
Check out: GlobalGraphOperations.at(graphDb).getAllNodesWithLabel(DynamicLabel.label('Label_Name')); http://api.neo4j.org/current/org/neo4j/tooling/GlobalGraphOperations.html#getAllNodesWithLabel(org.neo4j.graphdb.Label)

Categories : Java

How to traverse a dacpac
The way that we have found to do it is to find the property in object type using Linq, and then using the GetProperty method to get the value: bool isNullable = (bool)column.GetProperty(column.ObjectType.Properties.Where(p => p.Name == "Nullable").First()); This still doesn't feel like the best option, so if someone else has a better answer please post it.

Categories : C#

how to traverse inside a
For dynamically created elements use jquery .live() method to bind events. Jquery .on() or .click() [or any other event binders] will not work for elements added dynamically. Just try it this way : $(".delete").live('click', function(){ //Whatever you need to do... });

Categories : Javascript

Jquery Traverse DOM
Firstly the logic you have seems backwards to what you describe - you're hiding the p element if there are multiple li elements found, not if there are none. Secondly, closest() looks at parent elements, where as the p is a sibling of the div, so you'd need to use prev() instead. Try this: $('.clients').each(function() { var $ul = $(this); if (!$('li', $ul).length) { $ul.closest('.clients_wrap').prev('p').hide(); } });

Categories : Jquery

How do I traverse my HTML DOM in firebug?
Go to the DOM button in Firebug. In your search area type in 'document'. Hit the '+' symbol and open it up. Click 'body', and so forth. Everything starts at 'window'. Hint: Most of the time window is implicit, so you don't have to say window.document.getElementById();, or even window.onload = function(){*stuff here*/}. You do have to say window.onload if your testing to see if it exists, though. document is a property of window and has a series of its own properties and methods.

Categories : HTML

Traverse file vertically
You might find this task much simpler if you were to use mmap(2). There may be a C++ equivalent or wrapper, but I'm afraid I'm not much of an expert on that front. Hopefully someone will come along with a better answer if that's the case. Here's a quick C (not ++) example. I'll see if I can google around and C++ify it some more: #include <fcntl.h> #include <stdio.h> #include <string.h> #include <sys/mman.h> #include <sys/stat.h> #include <unistd.h> int main(void) { int fd = open("input", O_RDONLY); struct stat s; fstat(fd, &s); // map the file as one big string char *c = mmap(0, s.st_size, PROT_READ, MAP_SHARED, fd, 0); // calculate sizes int columns = strchr(c, ' ') - c; // first newline delimits a row int st

Categories : C++

traverse XML tree to get attribute value
You should be more careful about the XPath syntax. The correct form of your expression is //item[@id='1']/ancestor-or-self::*/@label_position You cannot use :: after a predicate, and you have to specify :: after an axis.

Categories : Xml

Traverse the HTML document
What you really should be using is jQuery. Then you can just do this: $("table")[0] to select the first table of the document. Simple as that. In other news, if that is your document, it isn't valid HTML, so Javascript DOM isn't guaranteed to work.

Categories : Javascript

How to traverse through attributes in xml through LINQ
If you are using C# you could do something like: XDocument document = XDocument.Load("filePath"); var states = (from state in document.Root.Descendants("state") where state.Attribute("id") != null && state.Attribute("id").Value == "1" select state).ToList();

Categories : C#

How to traverse through other parents with jQuery?
LIVE DEMO $('.num').keydown(function (e) { if (e.which == 34) { $(this).closest('form').next('form').find('.num').focus(); return false; } if (e.which == 33) { $(this).closest('form').prev('form').find('.num').focus(); return false; } }); As you can see I used .closest('form') it will allow you one day to use your textarea inside a fieldset without taking care of the jQuery, cause it'll always traverse the DOM the right way. Another nice way: DEMO $('.num').keydown(function (e) { var k = e.which; if ( k==34 || k==33 ){ $(this).closest('form')[k==34?'next':'prev']('form').find('.num').focus(); e.preventDefault(); } }); Another nice DEMO var $num = $('.num').keydown(function(e) { var k=e.which, c=$nu

Categories : Jquery

d3.js traverse hierarchical data
First you probably want to create a group inside a svg element. If you do that, you can create the main group first, and for each element, create the subgroups, binding the subProperties attribute to this subgroups: var svg = d3.select('#chart').append('svg') .attr('width', 100) .attr('height', 100); var data = [ {node : 1, subProperties : ["A", "B", "C"]}, {node : 2, subProperties : ["D", "E", "F"]} ]; var mainGroups = svg.selectAll('g.main') .data(data) .enter() .append('g') .classed('main', true); mainGroups.selectAll('g.sub') .data(function(d) { return d.subProperties; }) .enter() .append('g') .classed('sub', true); I wrote a jsfiddle with the code here. Regards.

Categories : Javascript

How to traverse DOM elements with jquery?
If this group of elements is always encapsulated within that .container div element then this should work: $(this).closest('div.conainer').find('.select') This is using closest to traverse up the DOM hierarchy (parent elements) and then find to traverse back down (child elements).

Categories : Jquery

traverse element inside the div
The delete_follower element is not a decedent of delete_followup element, it is a sibling element so instead of find() you need to use siblings() $(".delete_followup").click(function(){ var $this = $(this); $this.siblings(".delete_follower").show(); });

Categories : Javascript

Best way to traverse dom elements with a condition?
If you absolutely have to do it, it would be more efficient to iterate through the tree recursively, because then once you hit an element that is less than what you need, you know nothing inside of it can be the required size. Still seems like there would be a better solution under most circumstances, but I don't know your specific problem. EDIT: This works. function findElements( width, height, element ){ var results = Array(); for( var i=0; i<element.childNodes.length; i+=1 ){ var childElement = element.childNodes[i]; if( childElement.clientWidth == width && childElement.clientHeight == height ){ results.push(childElement); results = results.concat(findElements(width, height, childElement)); } else if( childElement.

Categories : Javascript

Traverse Tree in Java
what you want to do is traversing the tree with a depth-first algorithme. You will find a lot of example over the internet. Depending on how you make your tree. You can make a recursive algo passing each child from left to right or using a visitor pattern if you got a tree of object already loaded. First, take a look at http://en.wikipedia.org/wiki/Tree_traversal#Depth-first

Categories : Java

Traverse a circular path
if I think I understand the question correctly you are looking for a circle around a given point on an image. I have posted some code below, that will retrieve these points for you. im = zeros([50,50]); center = [20,20]; radius = 5; x = 1:size(im,1); y = 1:size(im,2); [xx,yy] = meshgrid(x-center(1),y-center(2)); dist = sqrt(xx.^2+yy.^2) circle = dist > radius-1 & dist < radius+1; im would just be whatever the image is your are looking at

Categories : Matlab

Only one out of three checkboxes checked in each tr of atable with checkboxes can be checked with jQuery
My suggestion is that you're using Checkboxes incorrectly. Checkboxes should be used to select multiple elements. If you only want one element to be selected then you should be using radio buttons which are explicitly designed for this case. Then you won't need to use any JavaScript.

Categories : Jquery

Binding datagrid in datagrid
You have problem with DataContext here. In RowDetailsTemplate you trying to binding to a property in main view model, but DataContext of RowDetailsTemplate is the row item. If you want to binding to property in your main view model you should use RelativeSource binding. Try this: <DataGrid ItemsSource="{Binding Path=Files}" SelectedItem="{Binding Path=DataContext.CurentFile, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" AutoGenerateColumns="False" > ...

Categories : Wpf

How can embed datagrid in datagrid
I don't think it's possible. You can indeed manually replace a cell with the HTML of another grid (your "child" grid), but Dojo maintains its data in a store. Your store won't be "aware" of any changes you make in the DOM nodes of your grid, and inserting a DataGrid in a store isn't possible either since the DataGrid maps its columns to properties of the data objects.

Categories : Database

How to add a new row in sql from datagrid and update sql row from same datagrid?
This article on codeproject does a nice (thorough) job of demonstrating what you are asking. It also comes with some demo code. http://www.codeproject.com/Articles/37430/Datagrid-Editing-Updating-Cancel-Selecting-Rows

Categories : SQL

How to traverse tree with specific properties
Python is close enough to pseudocode. class counter(object): def __init__(self, ival = 0): self.count = ival def count_up(self): self.count += 1 return self.count def old_walk_fun(ilist, func=None): def old_walk_fun_helper(ilist, func=None, count=0): tlist = [] if(isinstance(ilist, list) and ilist): for q in ilist: tlist += old_walk_fun_helper(q, func, count+1) else: tlist = func(ilist) return [tlist] if(count != 0) else tlist if(func != None and hasattr(func, '__call__')): return old_walk_fun_helper(ilist, func) else: return [] def walk_fun(ilist, func=None): def walk_fun_helper(ilist, func=None, count=0): tlist = [] if(isinstance(ilis

Categories : Python

DFS visitor does not traverse detached vertices
"If a graph is disconnected, DFS won't visit all of its vertices. For details, see finding connected components algorithm." Reference: Algolist You not are doing anything wrong. And your fix (finding other unvisited nodes, and starting the algorithm again) is what other implementations do. As further visible proof, look at this excellent implementation on TimL's page. You can keep clicking and watch the DFS being executed. (Scroll down to the middle of the page.)

Categories : C++

Best way to select and traverse records in database
You are returning tweets from repository, so each tweet in result should be constructed. That's why parameterless constructor is required. Constructing entities and mapping database fields to properties of created objects is what ORM does for you. Btw, you can avoid entities construction, if you will return only dates from database.

Categories : C#

Using variables to traverse an object in powershell?
You just need to specify $myObject rather than myObject. This code snippet produces the results I think you are looking for... $obj = Get-Item C:Windows $prop = "Name" # prints Windows Write-Host $obj.$prop # prints 7 Write-Host $obj.$prop.Length

Categories : Powershell

Traverse JSON object in Javascript?
your code should be like this $.each(vObj.tpaCo, function(key, value) { console.log(key +':'+ value); if(typeof(value)=='object'){ //console.log('Auditor length:'+vObj.tpaCo.value.length); } }); hope it helps.....

Categories : Javascript



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