I have some items in panel A along with some descriptions like time of delivery. All items in different div. In the second panel I have list of drivers with different timings like 9AM, 10AM and so on.
Now I need, that, when I drag and drop itemA from Panel1 to DriverA in panel2, I want that the item should be added to the dropped driver(DriverA) and the the cell of that particular driver with timing (say if item has to be delivered at 10AM , then then cell of driver with 10 AM changes the color to red).
There is support in jQuery for drag and drop.
See http://www.codeproject.com/KB/webforms/JQueryPersistantDragDrop.aspx and the documentation of jQuery.
Do this with a JavaScript framework like jQuery together with an AJAX framework like Prototype.
Make the Elements droppable with jQuery: http://jqueryui.com/demos/droppable/
Then store the information with an AJAX call using Prototype and the callback functions of the jQuery methods.
Related
I am writing a custom cell for GWT, but the data to be displayed will be fetched asynchronously (REST call). How do I make the rendering asynch for the cell?
I see ImageLoadingCell shows a spinner, then shows the image when it is loaded, this is done by a browser event, however, since mine is a REST call, I can't use the onBrowserEvent() method, and hence, I don't have a handle to the Element, to refresh its information.
I'm thinking maybe I have to do this through table.refresh()? I'd really like the render method to trigger the fetching however.
If you look at the goals of cell widgets, then I don't think this is possible and definitely not desirable :
Cell widgets (data presentation widgets) are high-performance,
lightweight widgets composed of Cells for displaying data.
I have faced a similar problem : suppose you have a Contact with a List of tags but only the tagIds are stored with the contact. To visualize the tags in the table, you would have to make callbacks to the server to get the names.
The solution is in using the adapter pattern. Create a ContactAdapter that holds the contact and the actual tags instead of the tagIds. Pre-fill the contact adapters with the tags based on the tagIds and set the List as the datasource for your celltable.
I'm trying to optimize a Carousel component and I wanna have only one active item in DOM. It is easy to achieve simply by removing/adding components in the cardswitch event of carousel. But the problem is that my components load some ajax info from server before rendering and it takes time, so it's slow to rerender them on each cardswitch.
Is there any technique to cache created components but at the same time to not add them to DOM?
Actually there is no way to keep items otside the DOM and then put them back, so the only solution I found is to recreate items when the became active. It's actually the way Sencha suggests.
The other interesting technique is the one Sencha implemented in ST2. It actually keeps only 3 items in DOM event if carousel has 100000 items. Check the html in Chrome. Haven't seen this carefully yet, but it's cool and performance is great.
With a GWT CellTable its possible to add different columns that handle the click event in different ways.
For example lets say we have 3 columns:
an Avatar Image (ImageCell),
a name (TextCell),
checkbox (Checkbox
cell).
Then image adding these events:
When the ImageCell is clicked we can open a popup.
When the checkbox is clicked select the row.
When the name is clicked open the users profile.
With a CellTable it's straight forward to accomplish this.
However what if we wanted a view that doesn't look like a table. The CellTable is tied to a HTML Table for its implementation. Why not allow for a general HTML implementation of the CellTable (behavioral) API.
Using a CellList we can accomplish any view. But the API isn't as sophisticated as the CellTable. It would be cool if we could add something analogs to CellTable 'Columns' to a CellList.
Is there anyway to accomplish this with the current Cell Widgets? I might have over looked something.
Thanks!
I think there are two solutions:
Use a CellTable and style it so that it looks like a CellList. This should be quite straightforward and possible. However you would have to play with the CSS styles a little bit. Best approach would be to use Firebug to change the styles on the fly and see the results instantly
Use a CellList and create a custom cell which renders and handles events for your use case (Avatar, Name and Checkbox). This is more involved but there is a tutorial on the GWT page.
I would probably try to go with solution 2 because it also teaches you how to create custom Cells which might come in handy later on.
Update:
As Thomas suggested in the comments you can use a CompositeCell which wraps 3 different cells. That's probably the easiest way to implement it.
I have a cellTable with 5-6 columns. I want to put a plus icon in each row on clicking of which will display the details maybe in a disclosure panel. I have been looking around for a while now and I cannot find any information on how to achieve this. Could someone point me in the right direction?
i suspect i probably have to add a cellTree to the column? how do i go about this?
Thank you for your response in advance.
There is work in progress to allow expandable rows in CellTable among other features (maybe GWT 2.3). You can see more details here:
http://groups.google.com/group/google-web-toolkit-contributors/browse_thread/thread/b4a8a6e3c98ac061#
If that is not enough or you can not wait untill it is released I can think of two ways to achieve it:
As you said, using a CellTree.
Creating a custom cell that stores
state (open/close). Depending on the
state the cell will render
differently. In same way it is
similar to how EditTextCell works, in
"edit" state it renders an input
field while in "normal" state it renders
simple text.
I'm trying to do that too ... I managed to mimic that functionality toying with the html and a custom cell class that allows clickable pictures.
It is working for normal content such as text but if you'd like to get an asynchronous data to show in the expended line, I don't know how to do it ... (I'm trying to do exactly that).
Also, it doesn't look good because the columns don't align well ...
So what I've done is:
- create a custom cell class to display a picture (right pointing triangle, looking like the triangle in the disclosure panel)
In the click event get the HTML code of the selected row and copy it. Replace the content of the row (all cells) in the table with only one cell with its colspan set to number of columns. In the cell, add a table with first line the copied row and second line the content to display as expanded.
Get the image to sink an event for closing. In event, reset the original row that we copied.
I hope it helps.
I would like to arrange UIControls in WPF in a similar way to the applications on the iPhone. They should be positioned on a grid, but a user should be able to drag them somewhere else, after releasing the mouse button (or the finger in case of an iPhone) the selected UIControl should snap back to the next position in the grid. The other UIElements should be rearranged automatically.
Further the user should also be connect two elements with a line or something.
I'm not experienced with WPF. The first question is if there is a container which is suitable for something (System.Windows.Controls.Grid ?) or if I have to extend canvas or somethig else for this.
I would like to know which elements from the WPF framework can be used and which elements I have to write myself.
For people who do not own an iPhone: http://www.youtube.com/watch?v=3omhu2AUWC8
Update
I've looked at AnimatedTilePanel in the BangOTricks examples (see below), this one explains how to create your own Panel and how to let it arrange things there.. However I still need an idea how to implement drag and drop correctly in this example..
Unfortunately, you'll have to write a lot of things yourself, as WPF doesn't automatically do what you're looking for.
For positioning the controls, you can use either UniformGrid or Grid. Assuming it's much like the iPhone video you showed, you can just use the UniformGrid with 4 columns and however many rows you need.
For the dragging animation, layout-wise, you could start by manipulating the RenderTransform property on whatever is being dragged, but you'll have to set a handler to check once you've met whatever threshold necessary to move into the another "cell" -- and at that point, you'll have to changed the order of the items in the tree.
Take a look at AnimatedTilePanel from Kevin's Bag-o-Tricks at:
http://j832.com/bagotricks/
It doesn't do everything you want but it will show you how to write a panel that animates its children when changing size or order.
New input to this old post in 09. Earlier this year (2012) someone has wrote a FluidWrapPanel and open sourced it. I tried it and it works like a charm - just like that on the iPhone menu.
You can also apply to other UI Elements or UserControl.