w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
sorting a datagrid with GWT
Apparently my issue was with the fact that I had a keyProvider in both classes, instead of just one. I removed it from the OpInventory class and it seems to work now. this looks like a very specific issue so I expect this question will be closed soon. but I'll leave the code there for future analysis.

Categories : Java

DataGrid sorts again after Sorting event
You need to stop routing of event by marking it e.Handled="True". Sorting is a bubbling event which is raised on the source element and navigates up to the visual tree until it reaches the root element or until the bubbling is stopped by marking the event as handled. These links will be helpful to understand RoutedEvents in WPF. http://wpftutorial.net/RoutedEvents.html. http://msdn.microsoft.com/en-us/library/ms742806.aspx

Categories : C#

How to disable multiple column sorting on a wpf DataGrid?
you can create a behavior and handle the sort be your self. the following is not tested :) public class DataGridICollectionViewSortMerkerBehavior : Behavior<DataGrid> { protected override void OnAttached() { base.OnAttached(); AssociatedObject.Sorting += AssociatedObjectSorting; } protected override void OnDetaching() { base.OnDetaching(); AssociatedObject.Sorting -= AssociatedObjectSorting; } void AssociatedObjectSorting(object sender, DataGridSortingEventArgs e) { var view = AssociatedObject.ItemsSource as ICollectionView; var propertyname = e.Column.SortMemberPath; e.Column.SortDirection = this.GetSortArrowForColumn(e.Column); if (view == null) return; view.Sor

Categories : C#

silverlight datagrid: sorting column bound to an object
Try this one, you dont have to create separate column for sorting, <sdk:DataGrid ItemsSource="{Binding PersonList}" AutoGenerateColumns="False"> <sdk:DataGrid.Columns> <sdk:DataGridTextColumn Binding="{Binding FirstName }" Header="FirstName" CanUserSort="True" /> <sdk:DataGridTextColumn Binding="{Binding LastName }" Header="LastName" /> </sdk:DataGrid.Columns> </sdk:DataGrid>

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

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#

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

Defining Multiple Comparators for Sorting and Reverse Sorting Appcelerator Backbone Models
To sort in descending order for strings(case insensitive) or just numbers, try this: var sort_descending = false; /* assuming you are able to set this variable when you need to sort */ var sort_attribute_name = "title"; /* assuming you can set the attribute name on which you want to sort */ book_list.comparator = function(book){ /* book_list is an instance of book_collection */ if(sort_descending){ if(isNaN(book.get(sort_attribute_name)){ var str = book.get(sort_attribute_name); str = str.toLowerCase(); str = str.split(""); str = _.map(str, function(letter){ return String.fromCharCode(-(letter.charCodeAt(0))); /* from an SO answer*/ }); } return -book.get(sort_attribute_name); } return book.get(sort_attribute_name); };

Categories : Sorting

CUDA parallel sorting algorithm vs single thread sorting algorithms
Sorting is an operation that has received a lot of attention. Writing your own sort isn't advisable if you are interested in high performance. I would consider something like thrust, back40computing, moderngpu, or CUB for sorting on the GPU. Most of the above will be handling an array at a time, using the full GPU to sort an array. There are techniques within thrust to do a vectorized sort which can handle multiple arrays "at once", and CUB may also be an option for doing a "per-thread" sort (let's say, "per thread block"). Generally I would say the same thing about CPU sorting code. Don't write your own. EDIT: I guess one more comment. I would lean heavily towards the first approach you mention (i.e. not doing a sort per thread.) There are two related reasons for this: Most

Categories : Sorting

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

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 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 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

C++ Bubble Sorting and Selection Sorting
#include <iostream> #include <string> #include <iomanip> using namespace std; void sortArray (int [ ], int ) ; void showArray (int [ ], int ) ; int count = 0; int main () { const int SIZE = 6; int values[SIZE] = {7, 2, 3, 8, 9, 1} ; cout << "The unsorted values are: "; showArray (values, SIZE) ; sortArray (values, SIZE) ; cout<< "The sorted values are: " ; showArray (values, SIZE) ; return 0; } void sortArray (int array [ ], int SIZE) { int temp; bool swap; do { swap = false; for (int count = 0 ; count < (size - 1 ) ; count ++) { if (array [count] > array [count + 1] ) { temp = array [count] ; array [count] = array [count + 1] ; array [count + 1] = temp ; swap = true ; count++; dispCount(); } } } while (swap) ; } void dispCount(){ cout <<

Categories : C++

JS object sorting date sorting
Both console.log show the same array because when you use console.log(sortable), sortable is passed by reference, and console output happens AFTER finishing your script - when sortable has been already sorted. Making your code simple: var arr = [3,2,1]; console.log(arr); // Produces `[1,2,3]` because its printed // to the console after `arr.sort();` arr.sort(); console.log(arr); // Produces `[1,2,3]`, as expected Demo: http://jsfiddle.net/Rfwph/ Workaround If you want to be able to do console.log with an array to see it before being modifyed, you can use .slice(0) to copy the array, i.e. to obtain another array which contains the same elements as your array. var arr = [3,2,1]; console.log(arr.slice(0)); // [3,2,1] arr.sort(); console.log(arr); // [1,2,3] Demo:

Categories : Javascript

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

Mongodb / Jongo sorting then limit, vs, limit then sorting
In normal queries, sort is processed first, then skip, and then limit, no matter in which order you add them to your cursor object. The aggregation framework will execute the $sort, $skip and limit operators in their order of appearance in the pipeline.

Categories : Java

sorting values in xml file not sorting last 4 values
If all you want to is output the same XML, but with option elements sorted by Value, then the following XSLT stylesheet will do that: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/> <xsl:strip-space elements="*"/> <!-- This is a modified identity transform. --> <xsl:template match="@* | node()"> <xsl:copy> <!-- Simply copy all attributes and child nodes, except for option nodes. --> <xsl:apply-templates select="@* | node()[not(self::option)]"/> <!-- Copy out all child option nodes, but order them by Value. --> <xsl:apply-templates select="option"> <xsl:sort select="Value"/> &l

Categories : Xml

WPF MVVM DataGrid/Map
Use ObservableCollection for your data source but don't bind to that because that will bind to the default view of your collection, bind both controls to ICollectionView that you control so as you change your collection view in code both controls will update without the need to write any code to sync them... So in your case, when you filter the data, your view that is using TwoWay binding will change and since the map is bound to same view the changes in view will be immediately visible in the map as well...

Categories : Wpf

Checkbox with DataGrid WPF
For an MVVM Solution you could try this: <StackPanel> <DataGrid ItemsSource="{Binding Path=TestItems}" AutoGenerateColumns="False" Name="MyDataGrid" CanUserAddRows="False"> <DataGrid.Columns> <DataGridCheckBoxColumn Binding="{Binding IsSelected}" Width="50" > <DataGridCheckBoxColumn.HeaderTemplate> <DataTemplate x:Name="dtAllChkBx"> <CheckBox Name="cbxAll" Content="All" IsChecked="{Binding Path=DataContext.AllSelected,RelativeSource={RelativeSource AncestorType=DataGrid}}"/> </DataTemplate> </DataGridCheckBoxColumn.HeaderTemplate> </DataGridCheckBoxColumn> <DataGridTe

Categories : Wpf

DataGrid Does not seem to allow editing
Ok, I just made an example that it is working. First I have my DataGrid definition: <asp:DataGrid ID="Grid" runat="server" DataKeyField="DatasetField1" AutoGenerateColumns="False" GridLines="None" OnCancelCommand="Grid_CancelCommand" OnEditCommand="Grid_EditCommand" OnUpdateCommand="Grid_UpdateCommand"> <Columns> <asp:BoundColumn HeaderText="Column1" DataField="DatasetField1"></asp:BoundColumn> <asp:BoundColumn HeaderText="Column2" DataField="DatasetField2"></asp:BoundColumn> <asp:EditCommandColumn EditText="Edit" CancelText="Cancel" UpdateText="Update" HeaderText="Edit"></asp:EditCommandColumn> </Columns> Second I must bind my data grid: public BindData() { .... Grid.DataSource = [MyDataSet With DatasetFi

Categories : C#

Triggers in datagrid
I'm not very experienced with DataGrid, so this might not be the best option, but I think you can achieve what you're after by styling the Row, rather than the individual Columns: <DataGrid <!-- Your settings here -->> <!-- Your column definitions here --> <DataGrid.RowStyle> <Style TargetType="DataGridRow"> <Style.Triggers> <DataTrigger Binding="{Binding Path=Errorcode}" Value="0"> <Setter Property="Background" Value="LightGreen" /> <!-- Other Setters --> </DataTrigger> <DataTrigger Binding="{Binding Path=Filename}" Value="File not created"> <

Categories : C#

Vi move through DataGrid
If I understand the issue correctly - you have a focus and selection per row. You want to move focus via k/j keys and to toggle selection via x key. I like to use behaviors in these situations - it requires reference to System.Windows.Interactivity.dll from blen SDK but it also makes for a cleaner and modular code. [edit: this is a quick POC that I did. It will probably require some more null reference protection and handling of fringe/edge cases] The behavior is: using System; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Input; using System.Windows.Interactivity; namespace GridNavigationTest { public class GridNavigationBehavior : Behavior<DataGrid> { #region Overrides of Behavior ///

Categories : C#

WPF DataGrid and ITypedList
ICustomTypeDescriptor implementation is required for Row objects. http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/177aef94-62c5-438d-a4a9-8834390559ad

Categories : C#

Cannot set DataGrid row header value
You should use HeaderText property of Columns collection instead: dataGridView_replaceTable.Columns[0].HeaderText="ROW HEADER 1"; You could also do this when you add your columns by using Caption property: public void addCol() { DataColumn column; column = new DataColumn(string colName); column.DataType = System.Type.GetType("System.String"); column.ColumnName = colName; column.Caption = "My header" // ASSIGN HEADERS HERE column.ReadOnly = false; replaceTableValues.Columns.Add(column); }

Categories : C#

Add, Edit DataGrid in WPF
if you have created a database or a list, u can retrieve data and print on the datagrid.. database db = new database (); //database employees emp = new employees (); //list or table in db var result1 = (from t in db.employees select t).ToList(); datagrid1.Itemssource=result1; it prints the data on datagrid

Categories : C#

How to have a DataGrid with two ButtonColumns in it?
Instead of OnSelectedIndexChanged="GradesDataGridSelectedCallback" Use OnItemCommand ="GradesDataGridSelectedCallback" And define your GradesDataGridSelectedCallback as Protected void GradesDataGridSelectedCallback(Object source , DataGridCommandEventArgs e) End Sub Checking e.CommandName would give you indication of which button is clicked.

Categories : C#

Can't refresh datagrid
If you see the old value with that type of data binding, it means you don't update the initial source, but only the temporary one (in your case t_KlantenViewSource). Calling Refresh method on the data added by FindResource cause app to reload it from pre-compiled resource, which won't change in this case. In other words, the problem is you use pre-compiled resource On the same time, you fill the dataset with actual data, but your dataset is in memory, view source - inside application file. You can try: binding ItemsSource of the entire datagrid or separate column to the TableAdapter dataset change resource compiling behaviour to Content, thus the app will reload it from external file each time you call Refresh method. ADDITION: You can find a solution for your case, just to save ti

Categories : C#

Opening PDF from a DataGrid
Process.Start("filename") will open a file using the default application on that machine. In most cases, the above approach is correct. It is not dependent on a particular application or particular version of the application being pre-installed on the target machine. The advantage is loose coupling between your application and the PDF viewer. If you really need to, you can use Process.Start() to launch a particular program, many of which will accept a filename as a command line parameter, like so: Process.Start("IExplore.exe", "C:myPathmyFile.htm") (This example taken from the linked MSDN documentation) You can find a list of Adobe Reader's command line arguments here: Adobe Reader Command Line Reference Update: The above link is old (focuses on version 7). You can find version 8 d

Categories : Vb.Net

Get hidden value from wpf datagrid
Rather than trying to read the value out of the Cell, why don't you just pull out the Databound item for your row? if (dgUserEnroll.SelectedItem != null) { var data = (User)dgUserEnroll.SelectedItem; var userID = data.UserId; }

Categories : C#

WPF - overlay text on top of datagrid row
If your rows have fixed height, you could add a another transparent datagrid on top of the other datagrid. The transparent datagrid would have one column which would show the disabled explanation. Simple but hacky solution. The proper way would be to use adorners. Here's an example of a datagrid with adorners.

Categories : Wpf

Bizarre WPF DataGrid issue
i think this is change in behaviour occurs because on one machine there is .NET 4.5 installed and on the other .NET 4.0 The behaviour of the WPF DataGrid seems to be a little different. In .NET 4, the DataGrid has some issues when binding to anonymous types. Solutions: Use .net 4.5 on all computers Define the DataGrid Columns manually and set AutogenerateColumns to false Use normal classes instead of anonymous types replace select new { Symbol = "XXX", Quantity = 6000, ... }; with select new Stock { Symbol = "XXX", Quantity = 6000, ... };

Categories : C#

How to add datagrid records to database?
first answer for me (and the easiest one but not recommended) is to scan the gridview one by one and insert data int the database one by one using loops Gridview.Rows.Cells[i].Text.ToString(); The second would be creating a datatable, the datatable would hold your gridview elements and then insert the whole datatable in the database using for each statement foreach (DataRow row in DataTable.Rows) Hope this helps :)

Categories : C#

DataGrid RowDetails Selection
I had the same problem: There is a DataGrid, and each row has a RowDetails - RowDetailsTemplate consists of two ListBoxes. ListBoxItem is a ToggleButton. So, I wanted to select toggle button by the first click. First I founded this http://wpf.codeplex.com/wikipage?title=Single-Click%20Editing . so, I updated my ListBox`s style <Style x:Key="MyListBoxStyle" BasedOn="{StaticResource ToggleButtonListBoxStyle}" TargetType="{x:Type ListBox}"> <Setter Property="ItemContainerStyle"> <Setter.Value> <Style TargetType="{x:Type ListBoxItem}"> <EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_PreviewMouseLeftButtonDown"></EventSetter> </Style> </Sette

Categories : Wpf

ScrollIntoView for WPF DataGrid (MVVM)
This should work. The idea is you have this attached property that you will attach to the DataGrid. In the xaml where you attach it, you'll bind it to a property on your ViewModel. Whenever you want to programmatically assign a value to the SelectedItem, you also set a value to this property, which the attached property is bound to. I've made the attached property type to be whatever the SelectedItem type is, but honestly it doesn't matter what the type is as long as you set it to something different than what it was before. This attached property is just being used as a means to execute some code on the view control (in this case, a DataGrid) in an MVVM friendly fashion. So, that said, here's the code for the attached property: namespace MyAttachedProperties { public class Sele

Categories : C#

Datagrid to csv not saving to file
It looks to me like you're writing strString to the file which is actually empty? Have you tried str.ToString() instead? i.e. System.IO.File.WriteAllText(Filepath, str.ToString());

Categories : C#

WPF DataGrid CustomSort for each Column
I did this by overriding the OnSorting event and implementing it myself. http://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid.onsorting.aspx Which basically meant re sorting the ListCollectionView. Sorry its not too in depth an answer.

Categories : C#



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