We thought it might be useful to proactively provide answers to the questions we’re asked most often by our developers. Here goes:
You should see a stack trace logged for the error either in your IDE’s main error Console, or if not, then in the Developer Console.
This may make it obvious what the problem is (look for obviously bad parameters being passed into methods). The best quality stack traces are available in compiled mode from Chrome, IE8 (but not IE9+) or Firefox. If it’s not self-evident what’s causing the error, post the complete stack trace along with all other required information to the forums.
#2 What’s the first thing to do when I run into issues?
Open your Developer Console. SmartClient/Smart GWT log many important warning messages and diagnostics to the Developer Console. Always, always, always have the Developer Console open when coding or testing.
#3 I think I found a bug. What do I do?
Post information that conclusively proves there is a bug in SmartClient/Smart GWT and not a problem with your own code, ideally, a single-file standalone test case that is as simple as possible and is ready to run on it’s own or can be run by pasting it into one of the Showcase examples.
Always post at least:
- your SmartClient version or your GWT version & Smart GWT version
- whether you were in Super Dev Mode, Classic/Legacy Dev Mode, or compiled mode
- browser version and operating system
- what you expected to happen, and, if applicable, the SmartClient/Smart GWT documentation that led you to believe your approach would work.
#4 I need a feature or enhancement added
If you are a professional developer, consider Isomorphic’s Feature Sponsorship program, which allows you to fund at-cost development of the features you need. For any general-purpose functionality you would otherwise build and maintain yourself, feature sponsorship is the quickest and least expensive option.
If you have no such resources, consider implementing it yourself. SmartClient/Smart GWT are open source in order to facilitate this. Create a clear, clean well-tested implementation and post it publicly for the best chance of having it included in future versions so you don’t have to maintain it.
Finally, you can post to the Wishlist forum. For the best chance of influencing the product roadmap, make a clear and compelling case for the feature – what great interfaces it would enable and why there is no viable alternative approach.
#5 I saved data and my grid/tree/picker didn’t update. Why?
SmartClient/Smart GWT feature automatic cache synchronization across all components that use a DataSource, that is, any DataSource modification operation that completes successfully (for example, an “update” operation) automatically propagates to all other components that use the same DataSource. This is discussed in more detail in the ResultSet docs.
If you are not seeing automatic cache sync:
1. verify your DataSource has a primaryKey field declared. This is how the different components understand that the record that has been updated is the same as the one they have cached.
2. make sure the data you are returning on successful “add” and “update” operations is correct. The DSResponse object is expected to contain the data-as-saved. The primary key value returned on an update must exactly match the value in the cached record. Note that field names are case-sensitive so check for mismatched case between the data and DataSourceField.name, such as “parentId” vs “parentID”.
3. in the Developer Console, use the Logging Preferences menu to enable diagnostics. Set the “ResultSet” (for ListGrids, ComboBoxItem or similar components) or “ResultTree” (for TreeGrids, PickTreeItems or similar components) diagnostic categories to Debug level. When the cache manager components receive your update/add/remove responses, they will log the data received and why it was either applied or ignored. If you do not see any logs about updating caches, this indicates the grid in question is not using a ResultSet / ResultTree at all, probably because you either did not call fetchData() / filterData(), or because you called setData() with a data model such as a RecordList or Tree, both of which are not aware of DataSources and will automaticallyupdate caches.
DO NOT just call invalidateCache() to fix a cache refresh problem … Read on
#6 Why is my application slow?
The most common issues are:
1. Firebug or the IE debugger is enabled, or you are testing performance in GWT “development mode”.
2. Browser caching disabled or crippled
Your browser may be set to non-default cache settings, and so is requesting media files repeatedly. End users won’t have these special settings, so to assess real-world performance, revert to browser defaults.
3. Server not advertising cachability of resources
Note this is automatic when using Smart GWT Pro or better.
4. Missing / incorrectly deployed images
In some cases the browser will wait for images to load before displaying components. If the images are failing to load, this can severely affect performance. Sometimes, images will still appear even though a failure to load has actually occurred, because the browser will fall back to a cached version after waiting for a failed image load.
For more potential causes of poor performance, read on.
See our blog of top performance tips here.
#7 What DOCTYPE should I use?
Generally, use the HTML5 DOCTYPE:
For IE9 and above, this is required, since Microsoft has crippled IE in any other mode (missing features and unavoidable memory leaks).Some corporate intranets force IE to use “Compatibility Mode” for all intranet sites, which overrides the HTML5 DOCTYPE declaration. You can work around this by using the following <meta> tag to force standards mode to be used for your application:
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
Any other use of the <meta> tag is invalid. For example, if you discover a bug that results from using meta tags to cause IE11 to behave like IE9, this is not a valid bug unless the same behavior also occurs in IE9.For IE8 and lower, it is recommended that DOCTYPE be omitted entirely. This is because IE8 is noticeably slower in “standards mode” and barely more standards-complaint than the default “quirks mode” anyway.Hence, if feasible:1. omit a DOCTYPE entirely for IE8 and earlier
2. use the HTML5 DOCTYPE for all other browsers
If it is impractical in your deployment or you don’t care about small differences in IE8 performance, use the HTML5 DOCTYPE for all browsers.
#8 Strange rendering behavior with browser zoom
At this time we cannot fully support browsers rendering with the zoom level set to something other than 100%. We have encountered too many native browser issues to make support for this feature feasible.
The actual behaviors observed at customized zoom level vary by browser and include odd rendering artifacts and various sizing and size-reporting issues. We will re-evaluate the situation regarding browser zoom periodically, and we will support it when it is feasible to do so.
#9 I installed a new version that was supposed to solve a problem, but everything is the same
Be sure you have followed the installation instructions when installing the new version.
If you discover that your IDE is mysteriously restoring stale files even after you’ve corrected everything, restarting the IDE may fix the problem. For Eclipse / MyEclipse, certain types of staleness can be fixed by switching to a different JDK (in the Eclipse Properties, under Java) and then switching back (yes, really, this works). If all else fails, reinstall the IDE and rebuild your project from scratch.
#10 (Pro or better) I can’t load my DataSource, DataSource.get() returns null
Go through the following checklist:
- Make sure the DataSourceLoader servlet is actually present in web.xml, that the required “Init” servlet is also present and that the <script src=> tag is pointing at the correct URL for the DataSourceLoader servlet. The easiest way to check the latter is to use Firebug’s NET panel.
- Make sure the DataSource ID you pass to DataSource.get() matches the file name (should be dataSourceId.ds.xml) and matches the ID attribute on the <DataSource> tag (note: attribute is “ID” not “id”). DataSource IDs are case sensitive, including the file name.
- Check that your server.properties setting for “project.datasources” matches the directory where you have placed your .ds.xml file
- Check the server-side log for errors such as malformed XML. If you see something about missing files, you have the wrong <inherits> tags in your .gwt.xml file – if you are using Pro or above, use <inherits name=”com.smartgwtee.SmartGwtEE”> and remove any inherit of com.smartgwt.SmartGWT, which is the LGPL version.
- Make sure the <script src=> tag pointing to the DataSourceLoader servlet is placed after the <script src=> for your application (*.nocache.js).
- Make sure you do not have basic errors in your .html such as the <script> tag not being closed, <script> tags outside of both <body> and <head>, multiple <body> tags or the like.
- If you are loading a very large number of DataSources, the URL can be too long and be rejected before it even reaches SmartClient/SmartGWT Server code. In this case, split the URL into two <script> tags
We also have a bunch more resources you may find helpful:
- Quick Start Guides (SmartClient, Smart GWT)
- Live showcases (SmartClient, Smart GWT)
- Consulting Services
Thanks for reading!
The Isomorphic Team