December 23, 2013, 7:44 am
I have an application with a set of single row DynamicForms (they contain fields that allow the user to set 'options' ... like SelectItem and other type fields). Depending on client resolution, I'd these forms to wrap to the next line (if not enough room) or stay right justified (if enough room). I'm able to accomplish the first requirement by putting each control in its own dynamicForm and then putting all the forms in a FlowLayout. However, when I do this, all the forms are aligned left.
How do I I make it so the FlowLayout will align its tiles starting from the RIGHT and move LEFT (rather than the default LEFT to RIGHT)? I've tried setLayoutAlign(Alignment.RIGHT) on each of the forms before adding them to the FlowLayout. I've tried a LayoutSpacer. I've tried various align options on the FlowLayout itself.
If I'm not able to accomplish this with the FlowLayout, is there another method I can use to allow
1. Fields aligned right on the page (akin to 'float:right')
2. Fields wrap to the next line if not enough room
I'm able to accomplish #1 using a single DynamicForm that contains all the fields wrapped in a HLayout with setAlign(Alignment.RIGHT). However, this doesn't accomplish #2.
Here's the current code I'm using.
Code:
private void populateDock(FlowLayout dock)
{
//This doesn't work
LayoutSpacer spacer = new LayoutSpacer();
spacer.setWidth100();
dock.addTile(spacer);
String id = paneldto.getId();
for (SelectorPaneDTO dto : paneldto.getSelectors())
{
DynamicForm form = new DynamicForm();
form.setHeight(22);
form.setMargin(0);
form.setPadding(0);
form.setCellPadding(0);
//This doesn't have any effect
form.setLayoutAlign(Alignment.RIGHT);
CanvasItem selectoritem = new SelectorRenderer(dto.getContent(), id);
form.setFields(selectoritem);
dock.addTile(form);
}
}
↧
December 23, 2013, 9:32 am
Hi everybody
I work on a project wich choises SmartGwt client and we are prospecting to use SmartGwtEE to acces more features.
I download the trial version 4.0p of smartgwt to test it in our project developpement platform.
But there's a big problem because our developpement computer haven't acces to the internet and smartgwtee check the version on the internet, trying acces to this url :
http://www.isomorphic.com/versionChe...C_EVAL_NIGHTLY
Isn't a way to test smartgwtEE offline before to purchase it?
↧
↧
December 23, 2013, 11:10 am
Configuring a TableView with a fetchOperation (operationId) and dataPageSize correctly fetches first batch of data but fails to include the operationId upon requesting "Load more records..."
Based on the traffic in the log, the fetchOperation is not provided to the server when "Load more records...." is selected by user.
_____________________________________________
1. /builds/SmartGWT.mobile/1.0d/LGPL/2013-12-23
2. Chrome Version 31.0.1650.63 m;
iPhone Safari
Sample Code
===============
Code:
// create table view for the options on this GUI
TableView tableView = new TableView();
tableView.setDataSource("testsource");
tableView.setTitleField("name");
tableView.setShowNavigation(true); tableView.setSelectionType(SelectionStyle.SINGLE);
tableView.setShowSelectedIcon(false);
tableView.setTableMode(TableMode.GROUPED);
tableView.setFetchOperation("testOperationId");
tableView.setDataPageSize(10);
tableView.setSort(new SortSpecifier("name"));
tableView.setInfoField("address");
tableView.fetchData(null, new DSCallback() {
@Override
public void execute(DSResponse dsResponse, Object rawData, DSRequest dsRequest) {
}
});
Code:
ServerLogs:
===============
*** Load of Data
=== 2013-12-23 18:47:37,303 [64-4] INFO RequestContext - URL: '/project/sc/RESTHandler', User-Agent: 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36': Safari WITHOUT Accept-Encoding header
Dec 23, 2013 1:47:37 PM com.google.apphosting.utils.jetty.AppEngineAuthentication$AppEngineUserRealm isUserInRole
INFO: Checking if principal test@example.com is in role *
Dec 23, 2013 1:47:37 PM com.google.apphosting.utils.jetty.AppEngineAuthentication$AppEngineUserRealm isUserInRole
INFO: Checking if principal test@example.com is in role admin
=== 2013-12-23 18:47:37,304 [64-4] DEBUG RestRequestParser - Parameter:'_sortBy'. Value:'name'.
=== 2013-12-23 18:47:37,304 [64-4] DEBUG RestRequestParser - Parameter:'_operationType'. Value:'fetch'.
=== 2013-12-23 18:47:37,304 [64-4] DEBUG RestRequestParser - Parameter:'isc_dataFormat'. Value:'json'.
=== 2013-12-23 18:47:37,304 [64-4] DEBUG RestRequestParser - Parameter:'_startRow'. Value:'0'.
=== 2013-12-23 18:47:37,304 [64-4] DEBUG RestRequestParser - Parameter:'_endRow'. Value:'10'.
=== 2013-12-23 18:47:37,305 [64-4] DEBUG RestRequestParser - Parameter:'_useStrictJSON'. Value:'true'.
=== 2013-12-23 18:47:37,305 [64-4] DEBUG RestRequestParser - Parameter:'_dataSource'. Value:'test'.
=== 2013-12-23 18:47:37,305 [64-4] DEBUG RestRequestParser - Parameter:'_textMatchStyle'. Value:'exact'.
=== 2013-12-23 18:47:37,305 [64-4] DEBUG RestRequestParser - Parameter:'isc_metaDataPrefix'. Value:'_'.
=== 2013-12-23 18:47:37,305 [64-4] DEBUG RestRequestParser - Parameter:'_operationId'. Value:'testOperationId'.
=== 2013-12-23 18:47:37,310 [64-4] DEBUG DSRequest - Caching instance 51 of DS test from DSRequest.getDataSource()
=== 2013-12-23 18:47:37,310 [64-4] INFO RESTHandler - Performing 1 operation(s)
*** After clicking "Load more Records..."
=== 2013-12-23 18:47:40,071 [64-4] INFO RequestContext - URL: '/project/sc/RESTHandler', User-Agent: 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36': Safari WITHOUT Accept-Encoding header
=== 2013-12-23 18:47:40,073 [64-4] DEBUG RestRequestParser - Parameter:'_sortBy'. Value:'name'.
=== 2013-12-23 18:47:40,073 [64-4] DEBUG RestRequestParser - Parameter:'_operationType'. Value:'fetch'.
=== 2013-12-23 18:47:40,073 [64-4] DEBUG RestRequestParser - Parameter:'isc_dataFormat'. Value:'json'.
=== 2013-12-23 18:47:40,073 [64-4] DEBUG RestRequestParser - Parameter:'_startRow'. Value:'10'.
=== 2013-12-23 18:47:40,073 [64-4] DEBUG RestRequestParser - Parameter:'_endRow'. Value:'20'.
=== 2013-12-23 18:47:40,073 [64-4] DEBUG RestRequestParser - Parameter:'_useStrictJSON'. Value:'true'.
=== 2013-12-23 18:47:40,074 [64-4] DEBUG RestRequestParser - Parameter:'_dataSource'. Value:'test'.
=== 2013-12-23 18:47:40,074 [64-4] DEBUG RestRequestParser - Parameter:'isc_metaDataPrefix'. Value:'_'.
=== 2013-12-23 18:47:40,078 [64-4] DEBUG DSRequest - Caching instance 52 of DS test from DSRequest.getDataSource()
=== 2013-12-23 18:47:40,078 [64-4] INFO RESTHandler - Performing 1 operation(s)
=== 2013-12-23 18:47:40,079 [64-4] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
↧
December 23, 2013, 12:22 pm
I'm trying to create a SmartGWT Window that has the entire left side up to the border occupied by one canvas(with a grey background) and a different canvas on the right(with a different color).
The problem that I'm coming up with is that no matter what I do with the margin functions, SmartGWT appears to place a 0 0 1 6 margin to the window, so the canvas on the left stops 6px from the left border. The margin is visible as element style from within firebug.
I've tried changing the margins directly within in the CSS, while this does fix the gap on the left, it creates a gap on the right(the width didn't change).
In a nutshell, how can I entirely fill a windows with canvases without any margins.
↧
December 23, 2013, 12:27 pm
Hi,
We experience a problem with ISC 9.0p. I can reproduce it on Chrome, FF and IE10.
The scenario is as follows :
1 - List is populated with an initial fetch
2 - I select one item to remove, and call ListGrid.removeSelectedData with a callback to add an extra-field to give some feedback to the user if an error occurs on the server.
3 - Server return an error (403 - Access denied in my case)
At this point, I expect to get my extra-field with an error image on the selected row. (That's the behaviour we had with 8.2p or 8.3p)
But, I can see that a new fetch request is triggered. And my extra-column is empty. If I re-select the item, and click on the delete button, the delete request is not sent and another fetch request is triggered.
I did a Log.getStackTrace() in my dataSource's transformRequest(), here is the result :
Code:
[a]MathFunction.getStackTrace(args=>undef, ignoreLevels=>undef, maxLevels=>undef, skipFBugTrace=>undef, extensionTrace=>undef)
BaseDataSource.transformRequest(dsRequest=>Obj)
DataSource.getServiceInputs(dsRequest=>Obj)
DataSource.sendDSRequest(dsRequest=>Obj)
DataSource.performDSOperation(operationType=>"remove", data=>Obj, callback=>null, requestProperties=>Obj)
Canvas.deleteRecords(records=>Array[1], deleteOperation=>Obj{ID:dsUser_remove}, context=>Obj, dataSource=>[BaseDataSource ID:dsUser])
Canvas.removeSelectedData(callback=>afterFlowCallback(), requestProperties=>undef)
[a]Dialog.callback(value=>true)
[c]Class.fireCallback(callback=>[a]Dialog.callback(), argNames=>"value", args=>Array[1], target=>[Dialog ID:isc_globalWarn], catchErrors=>undef) on [Class Dialog]
[a]MathFunction.fireCallback(callback=>[a]Dialog.callback(), argNames=>"value", args=>Array[1], catchErrors=>undef)
** recursed on [c]Class.fireCallback
baseDataSource.js?meiTpmVersion=${meitpm.build.version.full}:481
DELETE http://localhost:8080/TradeInsight/resources/Acme/user/2077 403 (Forbidden) ISC_Core.js?meiTpmVersion=${meitpm.build.version.full}:25410
XHR finished loading: "http://localhost:8080/TradeInsight/resources/Acme/user/2077". ISC_Core.js?meiTpmVersion=${meitpm.build.version.full}:25410
[a]MathFunction.getStackTrace(args=>undef, ignoreLevels=>undef, maxLevels=>undef, skipFBugTrace=>undef, extensionTrace=>undef)
BaseDataSource.transformRequest(dsRequest=>Obj)
DataSource.getServiceInputs(dsRequest=>Obj)
DataSource.sendDSRequest(dsRequest=>Obj)
DataSource.performDSOperation(operationType=>"fetch", data=>Obj, callback=>Obj, requestProperties=>Obj)
DataSource.fetchData(criteria=>Obj, callback=>Obj, requestProperties=>Obj)
ResultSet.fetchRemoteData(serverCriteria=>Obj, startRow=>0, endRow=>75)
ResultSet._fetchRemoteData()
[c]Class.fireCallback(callback=>"_fetchRemoteData", argNames=>undef, args=>Array[0], target=>[BaseResultSet ID:isc_BaseResultSet_0 (created by: isc_ListGrid_0)], catchErrors=>undef) on [Class EventHandler]
[c]Class._fireActionsOnPause()
** recursed on [c]Class.fireCallback
baseDataSource.js?meiTpmVersion=${meitpm.build.version.full}:481
XHR finished loading: "http://localhost:8080/TradeInsight/resources/Acme/user". ISC_Core.js?meiTpmVersion=${meitpm.build.version.full}:25410
But I can't be able to find why the fetch request is triggered.
Any ideas ? Thanking you in advance for your assistance.
↧
↧
December 23, 2013, 3:32 pm
Hi,
I have override getTile() method. In getTile() method I am taking Tile as CANVAS, and in canvas I have added VLayout as Child. In VLayout I am adding DynamicForm with couple of Controls.
As per my understanding in Tile there will be only one Child that is VLayout. But I am getting Three VLayout as Child. Please find attached Code...
On Click of button I am trying to get Tile as follows
@Override
public Canvas getTile(int recordNumber) {
final Canvas canvas = super.getTile(recordNumber);
canvas.setPadding(10);
VLayout layout = new VLayout();
layout.setLayoutAlign(Alignment.CENTER);
layout.setWidth100();
layout.setHeight100();
layout.setMembersMargin(1);
final DynamicForm form = new DynamicForm();
form.setBackgroundColor("lightgray");
form.setShowInlineErrors(false);
form.setAlign(Alignment.CENTER);
form.setNumCols(3);
form.setColWidths("10% 80% *");
TextItem lngOrderedQty = new TextItem("lngOrderedQty","Quantity");
lngOrderedQty.setWidth(80);
CheckboxItem cbfield = new CheckboxItem("chkAddItem","");
cbfield.setAlign(Alignment.LEFT);
cbfield.setShowTitle(false);
ButtonItem button = new ButtonItem();
button.setAutoFit(true);
button.setTitle("Add To Cart");
form.setFields(cbfield,lngOrderedQty);
layout.addMember(form);
layout.setAlign(VerticalAlignment.BOTTOM);
canvas.addChild(layout); // ADDED FIRST CHILD
canvas.setPadding(2);
canvas.markForRedraw();
return canvas;
}
Button addtoCart = new Button();
addtoCart.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Record [] records = (Record[])tileGrid.getSelection();
for(int i=0;i<records.length;i++){
Canvas tile = tileGrid.getTile(records[i]);
Canvas[] canvasChildArray = (Canvas[])tile.getChildren(); // HERE I AM GETTING 3 Child It Should get only ONE (VLAYOUT)
Canvas[] canvasChild = (Canvas[]) canvasChildArray[2].getChildren();
DynamicForm form = (DynamicForm)canvasChild[0];
form.clearErrors(true);
Map errorMap = new HashMap();
Object lObjorderQty = form.getField("lngOrderedQty")._getValue();
long lngMaxQty = records[i].getAttributeAsLong("lngMaxQty");
if(null==lObjorderQty){
errorMap.put("lngOrderedQty","Order Quantity is Requried...!");
}else{
long lngOrderQty = Long.parseLong((String)lObjorderQty);
if(lngMaxQty<lngOrderQty){
errorMap.put("lngOrderedQty","Required Quantity is not available...!");
}
}
form.setErrors(errorMap, true);
form.showErrors();
}
}
});
Regards,
DSingh
↧
December 23, 2013, 10:36 pm
Hi I am new to use smartGwt.
I want to know that whether I can use oracle or mysql database with smartgwt.
Thanks
↧
December 24, 2013, 5:29 am
Hi Isomorphic,
http://code.google.com/p/smartgwt/so...mItemType.java
has
Code:
RADIOGROUP_ITEM("radioGroup"),
which most likely should be
Code:
RADIOGROUP_ITEM("RadioGroupItem"),
with respect to the other *Items there.
Is this forum the place to report such things?
Is google code the place to look for Enum-Values to use in
.ds.xml files referenced in
http://www.smartclient.com/smartgwte...e-summary.html?
Right now I wanted to know what exactly to write in the DSField.
editorType-attribute, so I searched in the Showcases source for it, but only found "ComboBoxItem"
Thank you & Best regards,
Blama
↧
December 24, 2013, 1:30 pm
For a Calendar widget, is it possible to have custom formatters for the description and name of the events?
As in; I would like to concatenate two datasource fields for the description.
Possible?
↧
↧
December 25, 2013, 11:10 pm
Hello All,
In treeFrog skin in RTL some images like Tab header and comboBox selection Icon are not prepared to be working with the RTL, they are showing as they in the LTR.
Have a look at the attached image where the issue is clear there
Using SmartClient_v90p_2013-12-10_PowerEdition
↧
December 25, 2013, 11:58 pm
We have a customized print preview page from which the user can print what's shown on the preview page.
This works fine till showing what we want on the preview page. When the printer icon in clicked and the printer is selected to print, it prints nothing on the paper. That is, a blank page is printed without any contents.
The code is
Code:
PrintProperties printP = new PrintProperties();
printP.setAttribute("Orientation",PageOrientation.PORTRAIT);
Object[] myPrintObjects = new Object[] { content }; // Content is the VLayout to be shown on the Preview screen and printed
PrintWindow pWindow = new PrintWindow();
Canvas.showPrintPreview(myPrintObjects, printP, "Print Preview", null, pWindow, "Print");
But if I directly pass the VLayout to the Canvas.showPrintPreview, then the printing works fine.
Code:
Canvas.showPrintPreview(content);
The browser version used are IE 7.0 and FF Latest version.
The SmartClient/SmartGWT Framework is v8.3p_2013-01-16/Pro Deployment 2013-01-16.
Please let us know if we are missing out something here.
Any help is much appreciated.
Thanks in advance
↧
December 26, 2013, 2:16 am
Hi,
We are using SmartGWT 4.0 Library - Licensed Version.
As we required "pagination" for Tree Grid.
I have enabled the following properties for my Tree Grid,
grouptreeGrid.setDataFetchMode(FetchMode.PAGED);
grouptreeGrid.setDataPageSize(30);
grouptreeGrid.setAutoFetchData(true);
Data Source Used : "Rest Data Source"
We are sending "startIdex" and "Count" values in the Rest Request body as follows,
{
..
"startIndex":0, "count":30,
..
}
I have 50 child nodes in DB,
For the first time request is able to fetch first "30" records from the server,
But After scrolling down for the next 20 records, the request is not able to send by the "treeGrid" automatically like "List Grid".
Please let me know, Smart Gwt-4.0 is having the support or not.
If yes,
is it required any client side logic I have to added.
Please let me know your comments.
Thanks
↧
December 26, 2013, 6:27 am
Hi,
We have purchased smartGWT4.0 recently and have doubt in builds versions.
We want to know the difference between SmartGWT4.0d and 4.0p.
we are using 4.0 pro edition in our project ,we observed that in 4.1d also have pro build, can we use 4.1d instead of 4.0p.
Is it stable ?
Please let us know your comments.
Thanks.
↧
↧
December 26, 2013, 10:21 am
Hey Isomorphic,
I'm in the process of attempting to upgrade from SmartGWT 3.1 to SmartGWT 4.0 and receive the following Error (characterized by the following stack trace) below:
ERROR: Uncaught exception escaped
com.google.gwt.core.client.JavaScriptException: (TypeError) @com.google.gwt.core.client.impl.Impl::apply(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)([JavaScript object(1305), JavaScript object(1303), JavaScript object(1313)]): isc.isA.SGWTFactoryObject is not a function
at com.google.gwt.dev.shell.BrowserChannelServer.invo keJavascript(BrowserChannelServer.java:249)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke (ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative( ModuleSpace.java:571)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeO bject(ModuleSpace.java:279)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNati veObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.ja va)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.j ava:242)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(Meth odAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(Met hodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invok e(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reac tToMessages(BrowserChannelServer.java:293)
at com.google.gwt.dev.shell.BrowserChannelServer.proc essConnection(BrowserChannelServer.java:547)
at com.google.gwt.dev.shell.BrowserChannelServer.run( BrowserChannelServer.java:364)
at java.lang.Thread.run(Thread.java:662)
This occurs in the LGPL edition of SmartGWT 4.0, built on December 17, 2013. All browsers are affected, as this is a problem that is thrown on startup of the application and causes the load to fail completely.
The company I work for uses SmartGWT for a number of applications and a number of others work fine with the new (4.0) files, but this one obviously does not. Please tell me if you would like any sample code posted, as I am unsure what code you might need to aid me in debugging this issue, seeing as the stack trace is a bit unhelpful.
Thank you!
↧
December 26, 2013, 11:08 pm
I am evaluating the Visual Builder, hoping to draft some UI layouts rapidly for further development, or for non-developers to design prototype layouts.
Yet I found some of your fancy controls including in SmartClient are not available in the component library of the builder, e.g. calendar, chart, menu, ribbon bar, etc.
Is it possible to add them back to the component library?
Or is it intentionally not included such that we need to add them by code?
↧
December 26, 2013, 11:09 pm
Hi,
I am using Quick search on ListGrid (displaying top of the Grid) and below are the field definition :
<field>
<name>facilityCode</name>
<title>Facility</title>
<type>text</type>
<optionDataSource>facilityDSDMI</optionDataSource>
<filterEditorType>ComboBoxItem</filterEditorType>
<required>true</required>
<valueField>facilityCode</valueField>
<prompt>Facility</prompt>
<displayField>facilityCode</displayField>
<autoFetchDisplayMap>false</autoFetchDisplayMap>
<allowEmptyValue>false</allowEmptyValue>
filterEditorProperties operator ="iContains"/>
</field>
The requirement is, User can type in the Facility Dropdown instead of selecting value from drop down. To achieve this, used <filterEditorType>ComboBoxItem</filterEditorType> .
First time whenever user enter value in the Facility , List Grid is displaying data based on the substing entered in the Facility.
Next time if user search by Facility, it is not working even request is not going to backend. Also in both the cases the Search value is not displaying in the Facility Dropdown.
If I refresh the search, it seems all the search criteria mentioned before is appending into the criteria :
FYI:
criteria:[
{
fieldName:"facilityCode",
operator:"iStartsWith",
value:"abc"
},
{
fieldName:"facilityCode",
operator:"iStartsWith",
value:"xyz"
}
....
]
Please let me know how to fix the issue?. Let me know if any other details required from my side.
SC Version :
SmartClient Version: v9.0p_2013-08-16/Enterprise Development Only (built 2013-08-16)
Thanks !!!
↧
December 27, 2013, 8:29 am
Hello Isomorphic team:
I'm using your showcase from 2013-12-26 and ran into a problem with the dialog components.
Steps to reproduce.
1. go to your showcase from 2013-12-26
2. tap on Dialogs
3. tap on popover(I just picked this as example but it's happening with all dialog components).
4. tap on Show Popover(Then the dialog is shown)
5. press the phone back button(not the application back button)
see picture #1 for reference.
When the app slides back to the previous screen the dialog is still showing up. See picture #2 for reference.
Thanks
↧
↧
December 27, 2013, 10:29 am
Hey Isomorphic,
I've recently (almost, obviously) successfully upgraded SmartGWT from 3.1 to 4.0, but encountered a strange occurrence that seems strange enough to be a bug.
I am using a SelectItem which is placed as a member inside of a DynamicForm. A ListGrid serves as the SelectItem's PickList to format the dropdown cells' appearance and the SelectItem is given event handlers to change what is displayed on the page dependent upon which cell is selected in the SelectItem --- All of this works as expected.
The issue occurs when I try to display the currently selected cell's information as the SelectItem's text - only very specific strings are displayed when I use the setValue() function, with all other strings being set as the value *but not displayed on-screen as the item's text!* The only strings that *are* displayed are retrieved from the item I set as the SelectItem's ValueField. Is this intentional? If so, how can I design a workaround?
SmartGwt 4.0p - build 12/26/2013
All browsers affected.
Code below, as minimal as possible. Thanks!
Code:
accountCombo.setWidth(450);
accountCombo.setPickListWidth(450);
accountCombo.setShowTitle(false);
accountCombo.setValueField("valueField");
accountCombo.setSortField("accountNumber"); accountCombo.setCellStyle("doublePickListCell"); accountCombo.setPickListBaseStyle("doublePickList");
----
Code:
accountCombo.addChangedHandler(new ChangedHandler() {
@Override
public void onChanged(ChangedEvent event) {
String valueField = (String) event.getValue();
List<CustomerAccountServiceLocationRpc> rpcs = rpcMap.get(valueField);
if (rpcs != null && rpcs.get(0) != null) {
updateContext(rpcs.get(0));
accountCombo.setTooltip(getTooltipFormat(hoveredRecord));
if(hoveredRecord !=null){
String testRetrieval = hoveredRecord.getAttribute("displayField"); //Sets value but does not display
String testRetrieval3 = hoveredRecord.getAttribute("valueField"); //Works
accountCombo.setValue(testRetrieval);
accountCombo.setValue(testRetrieval3);
}else{
accountCombo.setValue("Error retrieving account information");
}
}
}
});
Would you like any other pieces of code? I'm not sure what will be relevant to your investigation.
↧
December 27, 2013, 2:59 pm
I have a window which contains master detail data. In this window there is some master data (omitted from sample) , and then a list grid with child items. From this window there is button to open a second window to get available data displayed in another list grid inside this second window.
The list grid in the second window has a record click handler to return the chosen record to the list grid in the first window.
The first time a record is selected it displays in the grid in the originating window by itself. Then when you open the second window again to get another record, and click a different record, you get duplicates in the first window. Please note, primary keys are set up in the datasources, and complaints are appropriately made when the same record attempts to be added again.
To recreate, run the sample, click the "press me" button, then click the "Add Item" button, then click the "NAME 1" record. Then click "Add Item" again and click the "NAME 2" record.
Very very grateful for any replies. I will take constructive criticism happily :)
Here's the code :-
Code:
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.*;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.types.*;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.HeaderDoubleClickEvent;
import com.smartgwt.client.widgets.grid.events.HeaderDoubleClickHandler;
import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class App implements EntryPoint {
List<ItemDetailDto> itemDetailDtos = new ArrayList<ItemDetailDto>();
List<ItemDetailDto> itemDetailDtosChosenFromSecondWindow;
com.smartgwt.client.widgets.Window addInvoiceWindow;
com.smartgwt.client.widgets.Window itemListWindow;
ListGrid itemsForInvoiceGrid = new ListGrid();
ListGrid itemsListGrid = new ListGrid();
ItemsForInvoiceDataSource itemsForInvoiceDataSource;
ItemListDataSource itemListDataSource;
com.smartgwt.client.widgets.Button addItemButton;
public void onModuleLoad() {
itemListDataSource = new ItemListDataSource();
itemsForInvoiceDataSource = new ItemsForInvoiceDataSource();
createItemsForInvoiceGrid();
createItemsListGrid();
createButtons();
createTwoTestRecords();
com.smartgwt.client.widgets.Button startButton = new com.smartgwt.client.widgets.Button();
startButton.setTitle("Press Me");
startButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
@Override
public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
showAddInvoiceDialog();
}
});
RootPanel.get().add(startButton);
}
private void createButtons(){
addItemButton = new com.smartgwt.client.widgets.Button();
addItemButton.setTitle("Add Item");
addItemButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
@Override
public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
itemsForInvoiceDataSource.setTestData(null);
itemsForInvoiceDataSource.invalidateCache();
itemListDataSource.invalidateCache();
itemListDataSource.setTestData(null);
showItemListDialog();
}
});
}
private VLayout createAddInvoiceLayout(){
VLayout mainLayout = new VLayout();
HLayout buttonLayout = new HLayout();
buttonLayout.setPadding(20);
buttonLayout.setAlign(Alignment.LEFT);
buttonLayout.setWidth(300);
HLayout itemLayout = new HLayout();
itemLayout.addMember(itemsForInvoiceGrid);
itemLayout.setPadding(20);
itemLayout.setAlign(Alignment.LEFT);
itemLayout.setWidth(300);
HLayout addItemLayout = new HLayout();
addItemLayout.addMember(addItemButton);
addItemLayout.setPadding(20);
addItemLayout.setAlign(Alignment.LEFT);
addItemLayout.setWidth(300);
mainLayout.addMember(addItemLayout);
mainLayout.addMember(itemLayout);
mainLayout.addMember(buttonLayout);
return mainLayout;
}
private VLayout createItemListLayout(){
VLayout mainLayout = new VLayout();
HLayout itemLayout = new HLayout();
itemLayout.addMember(itemsListGrid);
itemLayout.setPadding(20);
itemLayout.setAlign(Alignment.LEFT);
itemLayout.setWidth(300);
mainLayout.addMember(itemLayout);
return mainLayout;
}
private void createItemsForInvoiceGrid() {
ListGridField itemName = new ListGridField("itemName", "Item Name");
ListGridField itemCode = new ListGridField("itemCode", "Item Code");
ListGridField itemDescription = new ListGridField("itemDescription", "Item Description");
ListGridField amount = new ListGridField("amount", "Amount");
ListGridField id = new ListGridField("id", "ID");
itemsForInvoiceGrid.setFields(id, itemCode, itemName, itemDescription, amount);
itemsForInvoiceGrid.setHeight(250);
itemsForInvoiceGrid.setWidth(800);
itemsForInvoiceGrid.setTitle("Invoices");
itemsForInvoiceGrid.setDataSource(itemsForInvoiceDataSource);
itemsForInvoiceGrid.setAutoFetchData(true);
itemsForInvoiceGrid.setShowFilterEditor(true);
itemsForInvoiceGrid.setCanSelectAll(true);
itemsForInvoiceGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
itemsForInvoiceGrid.setSelectionType(SelectionStyle.SIMPLE);
itemsForInvoiceGrid.setModalEditing(false);
itemsForInvoiceGrid.setPreventDuplicates(true);
itemsForInvoiceGrid.setDataFetchMode(FetchMode.LOCAL);
itemsForInvoiceGrid.setShowAllRecords(true);
itemsForInvoiceGrid.setShowRowNumbers(true);
itemsForInvoiceGrid.setCanFocus(true);
itemsForInvoiceGrid.setCanResizeFields(true);
itemsForInvoiceGrid.setAlternateRecordStyles(true);
itemsForInvoiceGrid.setShowGridSummary(true);
itemsForInvoiceGrid.setShowGroupSummary(true);
itemsForInvoiceGrid.addHeaderDoubleClickHandler(new HeaderDoubleClickHandler() {
@Override
public void onHeaderDoubleClick(HeaderDoubleClickEvent event) {
// method stub
}
});
}
private void createItemsListGrid() {
ListGridField itemName = new ListGridField("itemName", "Item Name");
ListGridField itemCode = new ListGridField("itemCode", "Item Code");
ListGridField itemDescription = new ListGridField("itemDescription", "Item Description");
ListGridField amount = new ListGridField("amount", "Amount");
ListGridField test = new ListGridField("test", "Test");
ListGridField id = new ListGridField("id", "ID");
itemsListGrid.setFields(id, itemCode, itemName, itemDescription, amount, test);
itemsListGrid.setHeight(250);
itemsListGrid.setWidth(800);
itemsListGrid.setTitle("Items");
itemsListGrid.setDataSource(itemListDataSource);
itemsListGrid.setAutoFetchData(true);
itemsListGrid.setShowFilterEditor(true);
itemsListGrid.setCanSelectAll(true);
itemsListGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
itemsListGrid.setSelectionType(SelectionStyle.SIMPLE);
itemsListGrid.setModalEditing(false);
itemsListGrid.setPreventDuplicates(true);
itemsListGrid.setDataFetchMode(FetchMode.LOCAL);
itemsListGrid.setShowAllRecords(true);
itemsListGrid.setShowRowNumbers(true);
itemsListGrid.setCanFocus(true);
itemsListGrid.setCanResizeFields(true);
itemsListGrid.setAlternateRecordStyles(true);
itemsListGrid.setShowGridSummary(true);
itemsListGrid.setShowGroupSummary(true);
itemsListGrid.addRecordClickHandler(new RecordClickHandler() {
public void onRecordClick(RecordClickEvent event) {
if (!(event.getFieldNum() == 0)) {
if (itemDetailDtosChosenFromSecondWindow == null) {
itemDetailDtosChosenFromSecondWindow = new ArrayList<ItemDetailDto>();
}
ItemDetailDto itemDetailDto = new ItemDetailDto();
itemDetailDto.setAmount(event.getRecord().getAttribute("itemAmount") == null ? null : new BigDecimal(event.getRecord().getAttribute("itemAmount")));
itemDetailDto.setCode(event.getRecord().getAttribute("itemCode"));
itemDetailDto.setName(event.getRecord().getAttribute("itemName"));
itemDetailDto.setDescription(event.getRecord().getAttribute("itemDescription"));
itemDetailDto.setId(Long.valueOf(event.getRecord().getAttribute("id")));
itemDetailDtosChosenFromSecondWindow.add(itemDetailDto);
itemsForInvoiceDataSource.setTestData(null);
itemsForInvoiceDataSource.invalidateCache();
itemListDataSource.invalidateCache();
itemListDataSource.setTestData(null);
itemListWindow.destroy();
setItemsForInvoiceComponents();
}
}
});
itemsListGrid.addHeaderDoubleClickHandler(new HeaderDoubleClickHandler() {
@Override
public void onHeaderDoubleClick(HeaderDoubleClickEvent event) {
// method stub
}
});
}
class ItemListDataSource extends DataSource {
public ItemListDataSource() {
setID("itemListDataSource");
setClientOnly(true);
DataSourceIntegerField id = new DataSourceIntegerField("id");
id.setPrimaryKey(true);
id.setHidden(true);
DataSourceTextField itemName = new DataSourceTextField("itemName", "Item Name");
itemName.setAttribute("width", "10%");
DataSourceTextField itemCode = new DataSourceTextField("itemCode", "Item Code");
itemCode.setAttribute("width", "10%");
DataSourceTextField amount = new DataSourceTextField("amount", "Amount");
amount.setAttribute("width", "10%");
DataSourceTextField itemDescription = new DataSourceTextField("itemDescription", "Item Description");
itemDescription.setAttribute("width", "50%");
DataSourceTextField test = new DataSourceTextField("test", "Test");
test.setAttribute("width", "50%");
setFields(id, itemName, itemCode, itemDescription, amount, test);
}
}
class ItemsForInvoiceDataSource extends DataSource {
public ItemsForInvoiceDataSource() {
setID("itemForInvoiceDataSource");
setClientOnly(true);
DataSourceIntegerField id = new DataSourceIntegerField("id");
id.setPrimaryKey(true);
id.setHidden(true);
DataSourceTextField itemName = new DataSourceTextField("itemName", "Item Name");
itemName.setAttribute("width", "10%");
DataSourceTextField itemCode = new DataSourceTextField("itemCode", "Item Code");
itemCode.setAttribute("width", "10%");
DataSourceTextField amount = new DataSourceTextField("amount", "Amount");
amount.setAttribute("width", "10%");
DataSourceTextField itemDescription = new DataSourceTextField("itemDescription", "Item Description");
itemDescription.setAttribute("width", "50%");
setFields(id, itemName, itemCode, itemDescription, amount);
}
}
public void showAddInvoiceDialog() {
addInvoiceWindow = new com.smartgwt.client.widgets.Window();
addInvoiceWindow.setWidth(950);
addInvoiceWindow.setHeight(800);
addInvoiceWindow.setTitle("Add Invoice");
addInvoiceWindow.setShowMinimizeButton(false);
addInvoiceWindow.setIsModal(true);
addInvoiceWindow.setShowModalMask(true);
addInvoiceWindow.centerInPage();
addInvoiceWindow.setScrollbarSize(0);
addInvoiceWindow.setAlign(Alignment.LEFT);
addInvoiceWindow.addItem(createAddInvoiceLayout());
addInvoiceWindow.show();
}
private void showItemListDialog() {
itemListWindow = new com.smartgwt.client.widgets.Window();
itemListWindow.setWidth(850);
itemListWindow.setHeight(430);
itemListWindow.setTitle("Item List");
itemListWindow.setShowMinimizeButton(false);
itemListWindow.setIsModal(true);
itemListWindow.setShowModalMask(true);
itemListWindow.centerInPage();
itemListWindow.setScrollbarSize(0);
itemListWindow.setAlign(Alignment.LEFT);
itemListWindow.addItem(createItemListLayout());
itemListWindow.show();
setItemListComponents();
}
private void setItemsForInvoiceComponents() {
for (ItemDetailDto itemDetailDto : itemDetailDtosChosenFromSecondWindow) {
ListGridRecord record = new ListGridRecord();
record.setAttribute("itemCode", itemDetailDto.getCode());
record.setAttribute("itemName", itemDetailDto.getName());
record.setAttribute("itemDescription", itemDetailDto.getDescription());
record.setAttribute("amount", itemDetailDto.getAmount() == null ? null : itemDetailDto.getAmount().toPlainString());
record.setAttribute("id", itemDetailDto.getId().intValue());
itemsForInvoiceDataSource.addData(record);
}
itemsForInvoiceGrid.redraw();
}
private void setItemListComponents() {
for (ItemDetailDto itemDetailDto : itemDetailDtos) {
ListGridRecord record = new ListGridRecord();
record.setAttribute("itemCode", itemDetailDto.getCode());
record.setAttribute("itemName", itemDetailDto.getName());
record.setAttribute("itemDescription", itemDetailDto.getDescription());
record.setAttribute("amount", itemDetailDto.getAmount() == null ? null : itemDetailDto.getAmount().toPlainString());
record.setAttribute("id", itemDetailDto.getId().intValue());
itemListDataSource.addData(record);
}
itemsListGrid.redraw();
}
void createTwoTestRecords(){
ItemDetailDto itemDetailDto1 = new ItemDetailDto();
itemDetailDto1.setAmount(new BigDecimal("100"));
itemDetailDto1.setCode("CODE 1");
itemDetailDto1.setName("NAME 1");
itemDetailDto1.setDescription("DESCRIPTION 1");
itemDetailDto1.setId(1L);
itemDetailDtos.add(itemDetailDto1);
ItemDetailDto itemDetailDto2 = new ItemDetailDto();
itemDetailDto2.setAmount(new BigDecimal("200"));
itemDetailDto2.setCode("CODE 2");
itemDetailDto2.setName("NAME 2");
itemDetailDto2.setDescription("DESCRIPTION 2");
itemDetailDto2.setId(2L);
itemDetailDtos.add(itemDetailDto2);
}
class ItemDetailDto {
private Long id;
private String code;
private String description;
private String name;
private BigDecimal amount;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
}
}
↧
December 27, 2013, 8:11 pm
SwitchItem seems to provide different values on iPhone Safari iOS7 vs Win7 Chrome (Version 31.0.1650.63 m).
Sample code below:
Code:
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.smartgwt.mobile.client.data.Record;
import com.smartgwt.mobile.client.util.SC;
import com.smartgwt.mobile.client.widgets.Button;
import com.smartgwt.mobile.client.widgets.events.ClickEvent;
import com.smartgwt.mobile.client.widgets.events.ClickHandler;
import com.smartgwt.mobile.client.widgets.form.DynamicForm;
import com.smartgwt.mobile.client.widgets.form.fields.SwitchItem;
import com.smartgwt.mobile.client.widgets.layout.VLayout;
public class Test implements EntryPoint {
public Test() {
}
@Override
public void onModuleLoad() {
SwitchItem switchItem = new SwitchItem("name", "title");
switchItem.setChecked(false);
VLayout vLayout = new VLayout();
final DynamicForm dynamicForm = new DynamicForm();
dynamicForm.setFields(switchItem);
vLayout.addMember(dynamicForm);
Button saveButton = new Button("Save");
saveButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Record record = dynamicForm.getValuesAsRecord();
SC.say(""+record);
}
});
vLayout.addMember(saveButton);
RootLayoutPanel.get().add(vLayout);
}
}
1. Index of /builds/SmartGWT.mobile/1.0d/LGPL/2013-12-26
2. iPhone Safari iOS7 or Win7 Chrome (Version 31.0.1650.63 m)
3. N/A (non-server side probelm)
4. N/A
5. N/A
6. Code and pictures attached
↧