i'm creating a simple project to try gwt, but i'm a real noob :)
i've a table in my db, each row in this table has a unique id.
i want my application to read this table and display it's contents in a flextable, omitting the column containing the unique id in the db, 'cause the user is not interested in that id.
after that, i want the user to click on a row of the flextable and get a detailed view... but i need my unique id to get the detailed data about that row in my db!
i'm able to determine in which cell of the flextable the user clicked, so i created a simple widget with a string property and an int property, and i add this widget to the flextable setting the string property to the text from the db i want to display in the flextable and the int property with the db id value... when the user clicks, i get the widget contained in the cell and i can get my id back... but it looks like a very complex solution.
Creating a custom widget is the way to go as soon as your requirements exceed the functionality of the standard widgets provided by GWT.
Note: you may want to reconsider and use Grid instead of FlexTable. Grid seems better in your case since each row contains the same number of cells. See related topic about Grid and FlexTable comparison.
Related
I want to use a "Add" button to add empty rows in the table using table viewer. After adding a new row, the user can edit it. How can I implement this design? Thanks!
You should add the rows to the data that your content provider returns in the getElements method using something that the label provider will show as empty. You then call refresh on the table.
For editing you will use the normal EditingSupport and make sure it can deal with empty entries.
I'm using a CellTable, which is fed data via a ListDataProvider. Currently a user can sort the CellTable columns, then click a row. Clicking a row pops up a stand alone editor next to the cell table. When the user clicks "save", the code updates the employee in the ListDataProvider, then calls:
listDataProvider.refresh();
This works, but the column sort is reset. This is not acceptable because it resets the column sort that they have used, and it is a pain to have to resort the columns after every save. Is there some way to tell the CellTable to keep its current column sort when refresh is called?
Your need to call ColumnSortEvent.fire(dataGrid, dataGrid.getColumnSortList()); if you want to recover the sort order after refresh. I think it should work the same for CellTable.
This is how we refresh the DataGrid:
selectionModel.clear(); // SingleSelectionModel
dataList.clear(); // List<Data>
dataList.addAll(newData); // List<Data>
dataProvider.flush(); // ListDataProvider<Data>
dataProvider.refresh();
ColumnSortEvent.fire(dataGrid, dataGrid.getColumnSortList()); // DataGrid<Data>
Ended up adding a listener on the column sort, and sorted the list in code rather than allowing the CellTable to handle the sort. This kept the sort order. I'd post the code, but I no longer have access to the code base.
I have multiple records which needs to be displayed as part of a search. A single result can contain multiple records associated to it. If there are multiple records I need to display the record with (+) and when clicked it further displays the list.
I would like to know what the best way is to implement ( I have checked Custom data grid ex: http://gwt.googleusercontent.com/samples/Showcase/Showcase.html#!CwCustomDataGrid but would like to use UI binder)
Once the user selects a record from the expanded list, how can we load that selected record?
Any pointer are appreciated..! ( Currently on GWT 2.2)
Widget list
Tree or maybe StackPanel seems like it would be useful here.
Basically, I want to insert rows in the form InventJournalTransfer. I added a menuitem button that calls a class which opens a dialog where I fill a WMSLocationId, then I loop on Inventsum table to get all ItemIds with Available qty for this WMSLocationId and insert them into InventJournalTrans Table.
The code I wrote seems to be working as I have correct records inserted in my table(visible in Table browser, correct journalId, linenum itemId, qty etc...) BUT the records inserted do not appear in my form. I tried to refresh my form with or without code, but my grid's still empty.
I had a look at the class InventCountCreate that does what I want to do in a different journal type, but as I'm quite a newbie it is difficult for me to understand exactly how this class works.
Could anyone explain to me how to display my inserted rows in my form or give other leads?
The InventJournalTrans is table is inner joined to two InventDim, one related via the InventDimId field, the other via ToInventDimId.
Both fields must be filled with a valid InventDimId to an existing InventDim record for the form to show the record.
Have you tried right-clicking on your form's node in the AOT and clicking "Restore"? Perhaps your form is still using cached data.
I want to use cell tree as a cell table column. because GWT does not have tree table. In my current project, I have to make feature like item and it's subitem in cell table. so it is not possible without tree table
If any body have idea of this then please help to make it possible.
GWT 2.5 (to be released in a month or so) will add a CellTableBuilder that will let you generate additional rows; handling events on them will allow you to show/hide "child rows", mimicking a tree table.
Alternately, and withou waiting for 2.5, you can have your cells in a CellTree render columns (use a CompositeCell for flexibility and reuse). AFAICT thus is how Google Groups shows the unread count and menu for your favorite groups.
I am trying build tree table with tree widget plus flextable only. With the help of both, I am able to create custom tree table widget.
http://examples.roughian.com/index.htm#Widgets~Tree
finally..I able to create custom tree table as requirement.