Problems with checkboxes in Datagrids - silverlight

I am having some trouble with CheckBoxes in a DataGrid. The CheckBoxes are not bound to the entities that are populating the datagrid because there isn't a property on the entities for it. Basically what I am trying to do is when I check a CheckBox I add the ID of the item in that row to a list to be returned. The problem I am having is when I check some CheckBoxes and the page with the DataPager it uncheckes the CheckBoxes on the first page and tries to remove them but the DataGrid has already gone to the second page so it throws a null reference exception because it can't find those items anymore. How can I fix this? If you need me to post my code just let me know.

One approach to this is to customise the partial class that Entity Framework has created for you. Add your boolean property to the entity class. Now you can bind the checkbox column as any other column ant the data will be maintianed between paging.
You can then just enumerate through the items currently in the context select those have been checked.

Related

How to change value kendo grid row items using some data from external combobox?

I have a kendo grid in which I am using the roweditor function to allow user to change values of networks listed as network1, network2, network3 lets call it as gridNetwork.
I have a combobox on the same page having networks listed same as network1, network2, network3 what was there in grid. The user can select values from this combobox let us call it as comboNetwork.
Based on the selection made in the comboNetwork, the value of the selected row(s) network should also change in gridNetwork.
Any suggestions?
I have created a jsfiddle,give a try:
http://jsfiddle.net/Sowjanya51/a2agwrf5/2/
What you want is on-change function bound to your comboBox that will update your underlying data model that you have bound to your grid.
In that function, update the model, the refresh the grid's datasource that the model is populating.

Additional filtering parameters in #fuelux datagrid

Does the fuelux datagrid support adding additional filter options? I would like - for instance - to add (next to the filter dropdown you already have in place), a checkbox which should also be added as a parameter to my function that retrieves the data remotely from the server.
It would be nice if the grid would automatically take any parameters from input elements that we can mark by adding a specific class or data- attribute.
Thanks very much! :)
David.
You can absolutely do this.
Add filtering logic to the datasource you provide, keyed off any custom property you add to the datasource.
Add the checkbox within the datagrid markup (or anywhere).
When your checkbox is clicked, update the custom property on your datasource and then call $('#MyGrid').datagrid('reload') to tell the datagrid to reread your datasource

Select All CheckBox in RadGridView Header Column with Filterable Columns and Row Virtualization ON

I have a RadGridView, with filterable columns. I need to add a checkbox in the column header that checks all the rows that are a result of certain filters (if used).
When the CheckBox on the Header Column is checked, I just cannot update the values in the Binded collection, since there are Filters that user may apply to certain columns.
So, I tried the following:
var rows = EntityDataGridView.ChildrenOfType<GridViewRow>();
I then loop through the rows and update its data context. This solution works fine, however it does not work well with Row Virtualization turned ON. It only updates the VIsible rows on the screen. We have to deal with large amounts of data so we cannot turn off row virtualization.
I have a solution in mind, but I am posting this to get some more ideas on how this can be solved in a quick and better way.
The solution I have it, I pass to the View Model, the filter descriptors of the RadGridView, and then manually apply filtes to the collection in the view model and then, update the checkbox state. But is there a better way to handle this?
I don't know how telerik implements filters.
But, if its radgrid uses ICollctionView to filter collection, you can create your collection as ICollctionView, and iterate through the filtered collection of items.
var myCollectionView = CollectionViewSource.GetDefaultView(myDataSource);
...
foreach(var item in myCollectionView.OfType<TypeOfTheElement>())
{
item.IsChecked = value;
}
Notice that this will be work only if the ICollcetionView in the ViewModel is the same as used by telerik radgrid.
LOL, the solution to this problem turned out to be quite trivial, the "Items" property on the RadGridView has the filtered items and not the items from the data source. So, I used that one instead!

How to dehighlight the row when checkbox is checked in extjs grid

I am using extjs4.1 grid in aspnet mvc3 application.
I have used checkboxrowselection model.
the issue is :
once the checkbox is checked,the row should not get highlighted in the extjs grid.
How can i acheive this.
please help
The purpose of the checkbox selection model is to select rows. In extjs, selecting a row means to specifically highlight it, what you want is just a logical selection. You should be using the user extension: Ext.ux.CheckColumn that ships with the core library.
To gather the rows, you would need to do a query on the store where the models property is set to true for the data index you define on the checkcolumn.

Binding a combobox to a database and gridview

I am displaying a database table on a grid view and displaying a selected item's details in a detailsview.
Here's the problem:
There's a combobox in the detailsview and I want to display the added value's string on grid and I want the combobox to select this value.
It will be possible to update, delete the selected item from grid or add a new item. And I couldn't do the transformations of string- comboboxitem-database item. And I am quite confused on the binding operations. I hope my question is clear enough. Thanks in advance for any help.
One solution that may preserve your sanity. Only allow edits in your detailsView. Use the grid to Add (clicking an Add Link which shows the detailsView) or Delete. Is it really necessary for the user to be able to edit in either place?

Resources