I am trying to drag and drop hierarchical data in the same advanced data grid, and I would like the data provider to updated when the ADG is updated. (I want to be able to save and load this tree, so it is important that drags and drops are saved.)
I have a sample application (with view source enabled) posted here: www.crcarlson.com/adg/AdvancedDataGridDragAndDrop.swf
The sample app has an ADG showing hierarchical data as well as flat data. The first column of each datagrid shows the rowindex of the underlying data.
If you rearrange the items on the left ADG, the row indexes become unordered. If you click traceTree you see that the data provider is not in order.
On the other hand if you do the same on the right, the row numbers stay ordered even when the objects move around and if you click traceFlat, the data provider is in the order shown on ADG
My goal is to have the data provider order match the ADG order for the left grid which is displaying hierarchical data.
I would appreciate any advice on this, including "you can't get there from here, do it this way."
I noticed a few things while perusing your code and using the app:
Use an ArrayCollection instead of Array as the dataProvider for a view component whose data changes. This might solve your update problems.
If implementing an ArrayCollection doesn't completely solve your update problems, add the necessary logic to a dragDrop or dragComplete event handler.
I get a runtime error every time I drag an item from adg to adgFlat.
Here's Adobe's take on Using Drag and Drop. Specifically check out the last page titled "Moving and copying data". Good luck to you.
Related
My application is a tool library manager. It has a treeview containing a list of lists and tools. It also has a tableview showing a list of tools.
When I click on a list in the treeview, I want to show the tableview with the list of children. When I click on a single tool in the tree, I switch widgets and display the editform for the tool.
How do I limit the tableview to only the children of the selected node in the treeview?
My data model is a custom qAbstractItemModel.
I have a similar situation (not quite the same!) as yours. Before I share my experience, my assumption is that you have a database of sorts which consists of the items that make up your lists/tools.
One possible solution is to create two custom models, one for the tree view (say, MyTreeViewModel -> QAbstractItemModel, associated with QTreeView) and one for the table view (MyTableViewModel -> QAbstractItemModel, associated with QTableView).
The two custom models should be fed by the same agent working with the database. The key difference is that the tree view model works with the entire database, and the table view model with only a subset, that is, the children of the chosen item in the main list. Think of it as full mapping v. partial mapping of the database.
When the user clicks on the top list of nodes in the tree view, you can emit a signal which could be picked up by MyTableViewModel, populates with only the children, and is displayed by QTableView.
Because the same agent serves both models, you should be able to maintain data integrity, in the sense changes to the underlying data by one model should be reflected in the other model. This solution has worked out really well for my application. Hope this works for you too!
I'm not sure if this is a complete answer to my own question but I'm much closer. On the tableview I can call setRootIndex() and pass in the current item from the qTreeView. This works to show only the children of the current tree item in the table list.
For me, it still shows both tools and child lists, which I want to filter, but I think that's a different issue.
I am currently undertaking an exercise to research on a number of JS MV* frameworks and select one that best suits the team's needs. Knockout is one of the contenders that I am learning about.
One of the most important requirements is for changes in the data in a view model to be broadcast to all the views that use such data. For example, lets say we have client details listed in a data grid on a page, clicking on any row in the data grid brings up a pop-up dialog where the user can edit the values of the selected row. When the change is made and the user clicks 'Save', the data is updated in the database. But what we also want is that the change be reflected in the local ko.observablearray and then for any other views that use this 'clients' collection to refresh themselves with the new data. In other words the views must refresh themselves with the data in ko.observablearray rather than get a fresh list from the database.
I have been successful in doing this - have one a single .cshtml file which houses the data grid and a form to create new row in the data grid. In this scenario, the data in the grid refreshes correctly. But when the change happens on a another cshtml file, I am not able to carry these changes across to the other views. Can this be done in knockout and if yes, please point me to an example of how and where this has been done.
I would use a Event aggregator pattern. I have made one for SignalR
https://github.com/AndersMalmgren/SignalR.EventAggregatorProxy
Install usign nuget
Install-Package SignalR.EventAggregatorProxy
If you have no use for SignalR you can then extract the relevant parts from my lib, demo here
http://jsfiddle.net/jh8JV/
Introduction: I'm using java, oracle, flex, blazeDS etc. The part of the DB that is relevant to the task i am trying to accomplish is illustrated in the image below:
The Task table will also have a field called enabled , which i forgot in the figure below :) This field is used to enable some of the tasks based on various criteria, when an admin user presses a "Generate task list" button in the GUI.
Based on this generation of the task list, the users in the system should see a grid as the one displayed in the figure below :
This task list should display all the enabled task as illustrated above. The first three columns are retrived from the Task table in the DB, while the next columns(Column_4....Column_N) are generated based on the number of users in the User table. These columns should display the users alias. Each user is part of a UserGroup(Group), which i will model in either a separate table or in the User table itself, as illustrated in figure 1. The Numbers in the grid are based on the Time field in the Task_User table, while the first row below the users shows the sum of the times for each user.
Question: Im still learning Flex, and looking for every help i can get on accomplishing my goal :) I figure i have to implement a datagrid with dynamic columns. But how will the dataprovider work in this scenario? For each enabled taskid the grid has to fill the right user columns with time values. Any tips/help would be much appreciated! It is also important that loading this grid doesnt take to long :)
Is it possible to get horizontal and vertical text in the grid(like shown above)?
What I'm trying to do is have a 3 state tree expansion.
I have three different icons for "expand" "collapse" "semi-expanded" which I want to use to show a partially populated tree control with all nodes initialized to semi-expanded state and then on clicking the "semi-expanded" icon it gets data from server and populates the tree and open that branch with "expanded" icon.
I tried looking for it but couldn't find anything close to it except the 3-state checkbox but don't know how to use it on 3 state icon when tree would only maintain 2 states.
Thanks in advance.
I think what you are looking for is called a lazy-loading tree. There are lots of examples your can google for, but here is a great example.
As far as the visual part of your request goes (3 different icons to show that state of the branch or node) - you could easily handle that with a custom renderer, by looking at a flag on the node for it's load status.
Does that help?
A 3-State tree control is a bit uncommon and might therefore be a bit confusing; consider that even simple 3-state checkboxes are relatively rare and users may not be accustomed to them. Maybe that's why you didn't find such a tree control.
Thus, maybe you should consider using an alternate design that doesn't require 3-state controls.
For example, the node could start in collapsed node. If the user expands it, and there is no data yet, show a single sub node with the text "retrieving data..." (and a progress wheel or other progress indicator, if you can) and start data retrieval. When the data arrives, replace this sub node with the actual data.
I have a report that's being populated from an ObjectDataSource. The report includes expandable/collapsible nodes per user.
I'm allowing the viewer to filter the report by setting the FilterExpression on the datasource, then calling ReportViewer1.LocalReport.Refresh(). This is done during PostBack.
This filters the results, but the state of the expanded/collapsed nodes is lost. Is there some way to store the expanded/collapsed nodes in the ViewState? Or is there a better way to accomplish this altogether?
I know its been a while since this question was asked, but since i had to go through this recently i want to share my experience with somebody who might be dealing with this.
It's tricky but if you add a multivalued parameter to your report and the values match the values in the toggable fields, then you can write a group expression in the grid (And in the labels so those go away too). Once that is done, you just have to keep track of what is toggled (this is hard, but is possible with javascript).
Basically, there are two of the hidden child controls in the reportviewer control (indexes 4 & 5 in vs2008) that have the name of the event and the id of the table cell clicked, with this you cand build an array in javascript and keep track of the status of all toggable fields.