I need to create a quarterly expense report and I am confused what layout and widgets would be useful here
Quarter 1 Quarter 2 Quarter 3
Expense 1
Expense 2
Expense 3
I understand Celltable and DataGrids, but not sure If I can have data mappings of objects in the format as above. Mainly because these tables work with objects at a row level.
I have an object with data of the entire column instead.
Any ideas/ suggestions here ?
You have many options to choose from. The most obvious one is a FlexTable, but you can also simply put three floating FlowPanels next to each other.
With GWT you should use HTML for your layouts as much as possible unless you need some specific functionality from a widget.
EDIT:
Alternatively, you can use a DataGrid with a single row, where each cell is a custom cell that renders your object.
Finally, you can use DataGrid as a regular DataGrid - just modify the logic of what is displayed in each cell. For example, a cell can render like this:
final TextColumn<Integer> quarterColumn = new TextColumn<Integer>() {
#Override
public String getValue(Integer row) {
int column = myDataGrid.getColumnIndex(quarterColumn);
QuarterObject object = quarterObjects(column - 1);
return object.getExpense(row - 1);
}
};
Then you simply populate your DataProvider with an array of Integers from 1 to the number of records in your QuarterObject.
Related
Is it possible to have a grid column containing multiple types inside of it based on the value of a cell? Where each cell is rendered based on value. For instance, with in the same column a cell could be of type 'text' or 'datetime' or 'list' etc... and for each type I can use built in inline-editing? See image illustration below. Basically a key/value editor where the value column need to contain more than one 'type. Please post a sample answer.
It's possible, but you cannot rely on standard funtionality.
The idea of a w2grid is to assign a renderer to a column and render all cells of the same column in the same way.
You could implement a render function for your column and then generate the HTML for each cell based on those arguments:
http://w2ui.com/web/docs/1.5/w2grid.columns
Or you could override getCellHTML() for your grid.
Have a look at the implementation of getCellHTML() to see what awaits you if you want to customize it:
https://github.com/vitmalina/w2ui/blob/master/src/w2grid.js#L7396
Although it was a hack solution I ended up creating multiple grids aligned vertically each with a property & value column but the value column's 'type' attribute is different for each grid based on the w2ui framework out of box functionality I Desired for it. Each Grid is also separated by the header without padding to give it a feel like it is one grid. See Image below. now obviously the draw back of this is you cannot sort on all the fields but this is not required in my use case.
Sorry if this question is simple but I have googled and haven't found a satisfactory answer.
I'm creating an engineering cost estimator. I have a form that takes inputs as ISO/Drawing, and for each drawing number are many subforms where you can input ComponentDesc and should spit back out a TotalHours to complete number. I've included a picture (sorry for bad quality)
From the image, the table on the bottom is a subform in datasheet mode (which is usually hidden and located in the footer) which will calculate appropriate Total MH (manhours) for the ComponentDesc inputted into the subform on the right. I would like the small (and incomplete) textboxes to the left (below the title "MH Totals for ISO/Drawings") to display the aggregate total from the subform on the bottom.
I've been trying to use DSUM() to define Control Source for the textbox but it keeps coming back with #ERROR as seen in the textbox to the left. Right now what I have typed out is:
=DSum("[Total MH]","frm-PipingHandleMH")
in the expression builder. [Total MH] being my field and frm-PipingHandleMH being the subform on the bottom. I've tried to put brackets around everything but it didn't work (even though I'm not exactly sure what brackets usually do). Any advice?
DSum (and all domain aggregate functions) acts on a table or query. If you want to use that approach you need to refer to the source of that form and use a filter parameter to limit to appropriate records the I.E. if the form's datasource is qry-PipingHandles and if the form you are trying to sum on currently is showing handles for widget 4 then it would be something like:
=dsum("[Total MH]","qry-PipingHandles","[widgetID] = 4")
Note that if that 4 was the currrent state of form then you need to pass it in, so something like:
=dsum("[Total MH]","qry-PipingHandles","[widgetID] = " & [frm-PipingHandlesMH]![WidgetID].Value)
Where you reference the field in the form and append it onto the string that is applied as a filter to the source for Dsum.
Another approach is to put a subtotal in the footer of the form (iirc you don't actually need to show the footer) and then reference that footer control from the parent form.
Brackets are needed to demarcate names that include spaces or other odd characters, they also can be used (e.g. in query design view) to force Access to treat something as a name rather than a string literal.
I am creating a GWT app. In all my screens, one need is recurrent : adding a lot of components to a screen and have automatically them organized in 2 or 3 columns. I want to create a template for this but before, I wonder if there is already something defined for this need.
Ideally, that is what I would like to do:
MyLayout myLayout = new MyLayout(nbColumns);
myLayout.add(widget1);
myLayout.add(widget2);
myLayout.add(widget3);
myLayout.add(widget4);
myLayout.add(widget5);
...
and have the components automatically organizes in nbColumns columns.
Any solution in GWT or GXT 3 would be appreciated. I would also appreciate if this solution was usable with uiBinder.
Use TableLayout
Usage example:
public class TableForm extends ContentPanel{
setLayout(new TableLayout(2)); // number of columns in the table
Button button1 = new Button(); // any widget, button is just example
Button button2 = new Button();
add(button1,new TableData("100%","100%")); // width and height
add(button2,new TableData("100%","100%"));
}
Number in TableLayout's constructor is number of columns - layout automatically organizes your widgets in specified number of columns. You have to only perform add() operation.
Note, that usually it's better not to set height. In such case, widget's height will be default. Otherwise, it will be stretched to the specified percents.
One more advice - use setBorder(int width) (width>0) method of TableLayout to see how exactly TableLayout organized your components. Also, TableData objects has rowspan and colspan properties - you may find it useful.
I have a little piece of code which populates a CellTable from a
Type by adding the table as a DataProviders DataDisplay and by
using the DataProviders list to create a ColumnSortHandler and
corresponding Comparators... so each time the user clicks next I
populate the table in this manner with the next set of data. It all
works great apart from when the number of elements in my set of data
is greater than 15. In this case only the top 15 (ordered) elements
are displayed I.E. only 15 rows of the CellTable are visible within
the VerticalDialog. Is this a default somewhere or can I configure
this row limit. I've looked around my code and I can see places where
I have instantiated a list and this will default to 10 elements but 15
has me baffled.
I can provide code but thought this would jog a memory without the
need for boring old code.
Many thanks
Tony
This is a default yes: http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/user/cellview/client/CellTable.html#CellTable()
Constructs a table with a default page size of 15.
You can change it at any time with setPageSize or setVisibleRange.
Adding to Thomas Broyer answer. I always use the code below passing my CellTables/CellLists when I don't want pagination.
public static void setupOnePageList(final AbstractHasData<?> cellTable) {
cellTable.addRowCountChangeHandler(new RowCountChangeEvent.Handler() {
#Override
public void onRowCountChange(RowCountChangeEvent event) {
cellTable.setVisibleRange(new Range(0, event.getNewRowCount()));
}
});
}
I am trying to create a bill notice with payment stub underneath as a BIRT report.
My bill line items can be more than one. The report uses a gird layout with the bill line item information in a table.
I would like to
1 . get the table and the enclosing grid to expand as much as possible, if needed (without affecting the tear off stub position)
and if there is more line items it should spill over to the next page.
So, the first page layout is different from the next page(s) layout. Has anyone done something similar.
Please let me know how to acheive this in BIRT.
As long as you use relative sizing (percentages) instead of fixed dimensions in the "size" property (under the "General" properties) you should be fine.