Quantcast
Channel: SmartClient Forums
Viewing all 4756 articles
Browse latest View live

CSS in the calendar does not work well when using the calendar.setScrollToWorkday

$
0
0
this method tab in the day when change does not update disabled day camps until the mouse does not step above the cells

Code:
calendar.setWorkdayStart("08:00");
calendar.setWorkdayEnd("17:00");
calendar.setScrollToWorkday(true);

As I fix this

PhoneGap app not sending request to server

$
0
0
Hi,

I saw similar posts and tried their solutions but I was not making any progress so I was wondering if there is something in the way I am trying to send the request that's causing the problem.

I am using SmartGWT Pro 5.0p. And Cordova v 5.1.1.

My app is packaged as a phonegap app to run on android. The client makes a request using this code but I don't see anything reaching the server.

Code:

// added this line of code based on another thread in the forum
RPCManager.setActionURL("http://192.168.2.104:8080/MyApp/myapp/sc/IDACall");
               
DataSource ds = DataSource.get("person");
ds.setDataURL("http://192.168.2.104:8080/MyApp/myapp/sc/IDACall");

// prepare request               
Criteria crit = new Criteria();
crit.addCriteria("caller", "ft_mobile_login");
crit.addCriteria("email_id", uid);
crit.addCriteria("password", password);

DynamicForm df = new DynamicForm();
df.setDataSource(ds);

// send request to server
df.fetchData(crit, new DSCallback() {
        @Override
        public void execute(DSResponse response, Object rawData, DSRequest request) {

...

In PhoneGap's config.xml file the access parameter is set as follows. I left it that way.

Code:

<access origin="*" />
LogCat shows this output. The eglCodecCommon error shows up a lot even when there is no interaction with the app.

Code:

08-25 11:54:41.171: E/eglCodecCommon(2254): **** ERROR unknown type 0x0 (glSizeof,72)
08-25 11:54:41.171: E/eglCodecCommon(2254): **** ERROR unknown type 0x0 (glSizeof,72)
08-25 11:54:41.175: E/eglCodecCommon(2254): glUtilsParamSize: unknow param 0x00000b44
08-25 11:54:41.179: E/eglCodecCommon(2254): glUtilsParamSize: unknow param 0x00000bd0
08-25 11:54:41.189: E/eglCodecCommon(2254): **** ERROR unknown type 0x0 (glSizeof,72)
08-25 11:54:41.189: E/eglCodecCommon(2254): **** ERROR unknown type 0x0 (glSizeof,72)
08-25 11:54:41.446: I/chromium(2254): [INFO:CONSOLE(25)] "No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.", source: file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js (25)
08-25 11:54:41.661: E/eglCodecCommon(2254): glUtilsParamSize: unknow param 0x00000b44
08-25 11:54:41.661: E/eglCodecCommon(2254): glUtilsParamSize: unknow param 0x00000bd0
08-25 11:54:41.675: E/eglCodecCommon(2254): **** ERROR unknown type 0x0 (glSizeof,72)
08-25 11:54:41.675: E/eglCodecCommon(2254): **** ERROR unknown type 0x0 (glSizeof,72)

FilterBuilder inline-setShowSelectionCheckbox operators

$
0
0
SmartClient Version: v9.1p_2014-03-18/Pro Deployment (built 2014-03-18)

Im using the filter builder and trying to use the inline appearance in order to use the setShowSelectionCheckbox option to allow the user to selectively control clause application when filtering. Is there a way to set the operators per clause.

Currently it looks like the operator combo box per clause has options of "and" and "and not" ( The documented defaults). Id like to be able to have a "or" as well in order to have both "and" and "or" clauses in the filer.

To be clear I'm asking if is there a way control the permitted operations per clause when using inline appearance ?

Or is there some other way to accomplish this ?

Thanks

Using both ListGrid FilterEditors and SearchForm together

$
0
0
Using smartgwtpower-5.0p
Issue is on all browsers, but have used IE11 and Chrome

I am trying to find the best way to filter on a ListGrid using a combination of both a ShowFilterEditor and a DynamicForm (or SearchForm).
I started with an example from the showcase:
http://www.smartclient.com/smartgwtee/showcase/#sql_dynamic_reporting

The issue with that example is that you cannot remove a filter criteria from a field once it is added. You can change it, but you cannot remove it.
For example if you use the example above, the list starts out long. First filter down to date range: 02/27/2009 - 02/28/2009. Click filter and the list is correctly reduced.
Then remove the first date so that it is blank: empty string - 02/28/2009. Click filter and the list items do not change, the old filter value still applies.

In my example I am using Text fields (not Dates) and the Criteria on the field is not clearing when the FormField is blanked out.

Thanks for your help!

FormItem prompt message stuck in IE11 status bar

$
0
0
The prompt message of a FormItem (e.g. CheckboxItem) is stuck in the status bar of Internet Explorer 11 using SmartClient Version: v9.1p_2015-08-21/Pro Deployment (built 2015-08-21)

The problem can be reproduced by the following code snippet:

Code:

    var v = isc.VLayout.create();
    v.addMember(isc.DynamicForm.create({
        fields: [
        {
            name: "checkbox",
            prompt: "click me",
            type: "checkbox"
        }
      ]}));
    v.addMember(isc.DynamicForm.create({
        fields: [
        {
            name: "textItem1",
            type: "text",
            showTitle: false
        },
        {
            name: "textItem2",
            type: "text",
            showTitle: false
        }
      ]}));
  v.addMember(isc.IButton.create({title: 'Click'}));

Steps to reproduce:
1) Click on the 'checkbox' and 'click me' prompt appears on the IE11 status bar
2) Click on any other component (e.g. textItems, button)
ERROR) The 'click me' prompt message still appears on the IE11 status bar

This problem may seem intermittent at times but reloading the page and repeat the above steps seem always able to reproduce the issue.

----------------
SmartClient Version: v9.1p_2015-08-21/Pro Deployment (built 2015-08-21)
Windows 7 Internet Explorer 11.0.9600.17728CO

Issues Selecting Record from FilterEditor Search

$
0
0
Unable to select ListGrid Record that was just selected via Filter Editor.

Couple of issues:
1) Unexpected data type error: employees.ds.xml "EmployeeId" column is type Integer, but throws error unless I access it as a String

2) Selection appearance not updated. ListGrid Record can be selected, and values can be accessed/verified. But it does not assume the cosmetic appearance of a selected record.

This sample code can be run in the Built-In-DS sample project as is:
Code:

package com.smartgwt.sample.client;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.data.AdvancedCriteria;
import com.smartgwt.client.data.Criterion;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.OperatorId;
import com.smartgwt.client.types.SelectionAppearance;
import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.FilterEditorSubmitEvent;
import com.smartgwt.client.widgets.grid.events.FilterEditorSubmitHandler;
import com.smartgwt.client.widgets.layout.VLayout;

public class DemoRecordSelect implements EntryPoint {

 DataSource dsEmployees = DataSource.get("employees");

 @Override
 public void onModuleLoad() {

  makeLayout();

 }

 private void makeLayout() {

  VLayout vLayout = new VLayout();
  vLayout.setWidth100();
  vLayout.setHeight100();
  vLayout.setBorder("2px solid green");
  vLayout.setDefaultLayoutAlign(Alignment.CENTER);

  vLayout.addMember(makeListGrid());

  vLayout.draw();

 }

 private Canvas makeListGrid() {

  final ListGrid listGrid = new ListGrid(dsEmployees);
  listGrid.setWidth("80%");
  listGrid.setAutoFetchData(true);
  listGrid.setShowFilterEditor(true);
  // listGrid.setGroupByField("EmployeeType", "EmployeeStatus");
  listGrid.setSelectionType(SelectionStyle.SINGLE);
  listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
  listGrid.setReselectOnUpdate(true); // ?

  listGrid.addFilterEditorSubmitHandler(new FilterEditorSubmitHandler() {

  @Override
  public void onFilterEditorSubmit(FilterEditorSubmitEvent event) {

    Criterion[] criterions = event.getCriteria()
      .asAdvancedCriteria().getCriteria();

    Integer testParsedInteger = 0;

    for (Criterion criterion : criterions) {

    if (criterion.getFieldName().contentEquals("EmployeeId")) {

      // ISSUE #1: Unexpected Type Failure

      // Fails with GWT Exception
      // "JS value of type string, expected int"
      // Integer testInteger = criterion.getValueAsInteger();
      // int testInt = criterion.getValueAsInt();

      // Success
      String testString = criterion.getValueAsString();
      testParsedInteger = Integer.parseInt(testString);

    }
    }

    // ISSUE #2: Record selection does not *appear* selected

    AdvancedCriteria adCriteria = new AdvancedCriteria(
      "EmployeeId", OperatorId.EQUALS, testParsedInteger);

    Record filteredRecord = listGrid.find(adCriteria);
    listGrid.selectRecord(filteredRecord);

    SC.say(listGrid.getSelectedRecord()
      .getAttributeAsString("Name")); // reports name correctly, so record selection worked?

  }
  });

  return listGrid;
 }
}


Dev Mode Console Error re type error:
Code:

13:47:18.230 [ERROR] [builtinds] Uncaught exception escaped

com.google.gwt.event.shared.UmbrellaException: Exception caught: invoke arguments: JS value of type string, expected int
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129)
    at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:284)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:347)
    at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
    at java.lang.Thread.run(Unknown Source)
Caused by: com.google.gwt.dev.shell.HostedModeException: invoke arguments: JS value of type string, expected int
    at com.google.gwt.dev.shell.JsValueGlue.getIntRange(JsValueGlue.java:266)
    at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:144)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:65)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:284)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.smartgwt.client.util.JSOHelper.getAttributeAsInt(JSOHelper.java)
    at com.smartgwt.client.data.Criterion.getValueAsInteger(Criterion.java:600)
    at com.smartgwt.sample.client.DemoRecordSelect$1.onFilterEditorSubmit(DemoRecordSelect.java:64)
    at com.smartgwt.client.widgets.grid.events.FilterEditorSubmitEvent.dispatch(FilterEditorSubmitEvent.java:111)
    at com.smartgwt.client.widgets.grid.events.FilterEditorSubmitEvent.dispatch(FilterEditorSubmitEvent.java:1)
    at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
    at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
    at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
    at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
    at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:284)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:347)
    at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
    at java.lang.Thread.run(Unknown Source)

----------------------------
Info:
Eclipse Luna
GWT 2.6
Smart GWT: SmartClient Version: v9.1p_2015-08-21/PowerEdition Deployment (built 2015-08-21)
IE8
Classic Dev Mode

Testing application in eclipse and dev mode

$
0
0
Hello there,

I am using SmartClient Version: v10.0p_2015-07-08/PowerEdition Deployment (built 2015-07-08) along with FF26.

I have a simple html login page and then after successful login I forward the user to the sgwt main html page. Now my question is in eclipse when I want do my testing and right click on my project and select Run as -- Web application,eclipse provides me with 2 html file. the simple login html page and the sgwt html page. Now i want to know which one should i go for or it makes no difference. Can somebody please explain this to me.

cheers
Zolf

incorrect sql query after applying grid filters

$
0
0
Hi Team,
We are currently using:-
BuildDate Wed Mar 05 15:52:00 IST 2014
Version 4.1p
SCVersionNumber v9.1p_2014-03-05

I am applying some 'grid filters'

and trying to fetch sql query with
SQLDataSource.getSQLClause(SQLClauseType.All, dsRequest);

here my query is having one of the where clause as:
(LOWER(FIELD_CALC_ATTR_VIEW_HIGH.CONVENTIONAL_UNCONVENTIONAL) = LOWER('[conventional]')


(see the square braces abound 'conventional')

The query otherwise looks fine (in isomorphic logs):

(LOWER(FIELD_CALC_ATTR_VIEW_HIGH.CONVENTIONAL_UNCONVENTIONAL) = LOWER('conventional')

only when i am trying to fetch it using SQLDataSource.getSQLClause , i am facing this issue.


could you please tell how I can fetch the correct sql query?

Different datasources per client

$
0
0
I need to use a different .ds.xml per client, which has a clientId.
Is it possible to do this? For example, to have the .ds.xml files in different folders, example:
1/file.ds.xml
2/file.ds.xml

where 1 and 2 are the clientIds.
But:
What would be the datasource id?
And what to put in DataSourceLoader?dataSource= ?
Using smartgwt 5.0p power.

JDK Version for SGWT

$
0
0
I'm using SmartGWT 5.0p (v10.0p_2015-06-03/Enterprise Deployment (built 2015-06-03) and using JDK 1.7
Is anybody knows what is JAVA version as PRE - REQUISIT for using SGWT v10.0? Is it 1.7 or higher? Would Java 1.6 be good for this?
Thanks in advance

Passing Java object to Server

$
0
0
SmartClient Version: v10.0p_2015-06-10/PowerEdition Deployment (built 2015-06-10)

Browser Version : IE 11.0.9600.17843

How to pass the Java object (Simple POJO) from client to Server DMI class.

//Client code
TestClass testClass = new TestClass();
testClass .setName("Tester");
Method 1:
Criteria lCriteria = new Criteria();
lCriteria.addCriteria("testObject",testClass );


//Also tried with Method 2:(OR))
DSRequest lDSRequest = new DSRequest();
lDSRequest.setAttributeAsJavaObject("test2", testClass);

dataSourceGrid.fetchData(lCriteria, new DSCallback() {
@Override
public void execute(DSResponse pDsResponse, Object pData, DSRequest pDsRequest) {
//Some Business
}
}, lDSRequest);

//Server code (DMI Class)
Method 1:
TestClass testClass = (TestClass) dsRequest.getCriteriaValue("testObject");

Method 2:
TestClass testClass = (TestClass) dsRequest.getAttribute("test2");

I am getting null in the Server class.

DynamicForm: Bug with save after clearValues()

$
0
0
Hi Isomorphic,

Please the the following issue I stumbled into when creating a testcase for another issue.

Case 1:
  1. Hit Reload
  2. Enter Data
  3. Hit Save

Case 2:
  1. Hit Reload
  2. Hit Load Button
  3. Hit Clear Button
  4. Enter Data
  5. Hit Save

BuiltInDS.java
Code:

package com.smartgwt.sample.client;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.core.KeyIdentifier;
import com.smartgwt.client.data.AdvancedCriteria;
import com.smartgwt.client.data.Criterion;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.types.OperatorId;
import com.smartgwt.client.util.PageKeyHandler;
import com.smartgwt.client.util.Page;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;

public class BuiltInDS implements EntryPoint {
        private VLayout vL;
        private TestForm tF;
        private HLayout hL;

        public void onModuleLoad() {
                KeyIdentifier debugKey = new KeyIdentifier();
                debugKey.setCtrlKey(true);
                debugKey.setKeyName("D");

                Page.registerKey(debugKey, new PageKeyHandler() {
                        public void execute(String keyName) {
                                SC.showConsole();
                        }
                });

                vL = new VLayout(5);
                vL.setTop(20);
                vL.setLeft(20);
                vL.setWidth100();
                vL.setHeight100();
                tF = new TestForm();

                hL = new HLayout(5);

                IButton load1 = new IButton("Load Charles Madigen");
                load1.setWidth(200);
                load1.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                                tF.fetchData(new AdvancedCriteria(new Criterion("EmployeeId", OperatorId.EQUALS, 4)));
                        }
                });

                IButton load2 = new IButton("Load Ralph Brogan");
                load2.setWidth(200);
                load2.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                                tF.fetchData(new AdvancedCriteria(new Criterion("EmployeeId", OperatorId.EQUALS, 192)));
                        }
                });

                IButton clear = new IButton("Clear");
                clear.setWidth(200);
                clear.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                                tF.clearValues();
                        }
                });

                IButton save = new IButton("Save");
                save.setWidth(200);
                save.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                                tF.saveData();
                        }
                });

                IButton reload = new IButton("Reload");
                reload.setWidth(200);
                reload.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                                vL.removeChild(tF);
                                vL.markForRedraw();
                                tF.markForDestroy();
                                tF = new TestForm();
                                vL.addMember(tF, 0);
                        }
                });

                hL.addMembers(load1, load2, clear, save, reload);
                vL.addMembers(tF, hL);
                vL.draw();
        }

        private class TestForm extends DynamicForm {
                public TestForm() {
                        super();
                        setDataSource(DataSource.get("employees"));
                        setAddOperation("myAdd1");
                        setUpdateOperation("myUpdate1");
                        setAutoFetchData(false);
                }
        }
}

employees.ds.xml (Main change: pkField hidden="true")
Code:

<DataSource ID="employees" serverType="sql" tableName="employeeTable" recordName="employee"
        testFileName="/examples/shared/ds/test_data/employees.data.xml" titleField="Name">
        <fields>
                <field name="userOrder" title="userOrder" type="integer" canEdit="false" hidden="true" />
                <field name="Name" title="Name" type="text" length="128" />
                <field name="EmployeeId" title="Employee ID" type="integer" primaryKey="true" required="true" hidden="true" />
                <field name="ReportsTo" title="Manager" type="integer" required="true" foreignKey="employees.EmployeeId" rootValue="1" detail="true" />
                <field name="Job" title="Title" type="text" length="128" />
                <field name="Email" title="Email" type="text" length="128" />
                <field name="EmployeeType" title="Employee Type" type="text" length="40" />
                <field name="EmployeeStatus" title="Status" type="text" length="40" />
                <field name="Salary" title="Salary" type="float" />
                <field name="OrgUnit" title="Org Unit" type="text" length="128" />
                <field name="Gender" title="Gender" type="text" length="7">
                        <valueMap>
                                <value>male</value>
                                <value>female</value>
                        </valueMap>
                </field>
                <field name="MaritalStatus" title="Marital Status" type="text" length="10">
                        <valueMap>
                                <value>married</value>
                                <value>single</value>
                        </valueMap>
                </field>
        </fields>

        <operationBindings>
                <operationBinding operationType="add" operationId="myAdd1" cacheSyncOperation="myFetch1" />
                <operationBinding operationType="fetch" operationId="myFetch1" outputs="EmployeeId, Name, EmployeeType">
                        <criteria fieldName="EmployeeId" operator="notNull" />
                </operationBinding>
                <operationBinding operationType="update" operationId="myUpdate1" cacheSyncOperation="myFetch1" />
        </operationBindings>
</DataSource>

As you will notice the error messages are different and I think the STATUS=VALIDATION_ERROR message is correct, while the STATUS=-4 is not.
After clearValues() I'd expect the DynamicForm to behave like if it were freshly loaded.

I'm using v10.0p_2015-08-24/PowerEdition.

Best regards
Blama

DS Field name same as table column name in DataSource

$
0
0
SmartClient Version: v10.0p_2015-06-10/PowerEdition Deployment (built 2015-06-10)
Browser Version : IE 11.0.9600.17843


1. I have SQL DataSource (test.ds.xml) and its mapped with table TEST_TABLE. here i hope we have to give field name as table cilumn name

<DataSource tableName="TEST_TABLE" ID="testTable" serverType="sql">
<fields>
<field name="NAME" title="Name"></field>
<field name="COUNTRY" title="Country"></field>
</fields>
</DataSource>

2. This dataSource is assigned to ListGrid
3. I have to fetch some data based on the given "Name", So I am using the Criteria to fetch the same.

AdvancedCriteria lCriteria = new AdvancedCriteria(OperatorId.AND);
lCriteria.addCriteria("NAME", "tester");

My question is in the above code, I am creating the criteria in the Client side and now the table column (DS field)name ("NAME") is directly used
in the client code and also after displaying the list grid and need to get some data from listgrid when I click the grid record,
at that time also I have to use the table column name to get that because field name same as table column. Here table column name used as the DS field name.

How to avoid using the DS field name in the ds.xml.

Format headers of columns in Calendar

$
0
0
how can I change the calendar's header? I mean, I want to show only the days like monday, tuesday, wednesday...no "wed 08/26"

CanvasItem not overflowing outside canvas

$
0
0
Am using smartGWT 4.0.x and Firefox 21

Am trying to implement typeAhead search using third party jquery. I created a canvas and overrode the getInnerHTML() method to write the html for the search bar. I used the onDraw() method to load the jquery.

I got the canvas instance and in my vlayout, i added it by setting it into a 'canvasItem'. The typeahead function is getting called and am getting the value. But the dropdown feature from the jquery is getting bound within the canvas. Its not overflowing out of the canvas. Though this is an Item, i hav to set it to the form and then place it inside a layout. Any help would be appreciated.

Strange errorlog in TimeLine when loading data

$
0
0
Hi, i'm getting some really strange errors when i load data in my Timeline:

"getVisibleEvents() encountered a place-holder for a loading record, rather than a valid record"

I'm kind of at a loss for what that means, all my events are loaded from the server, and have ID's. From what i can tell, the events do end up in the timeline when all is finished.

If you had any pointer as to where i should start looking, i'd appreciate it.


ERROR: 23:36:10.686:XRP2:WARN:TimelineView:isc_MyScheduleTimeline_0_timelineView:timeline.getVisibleEvents() encountered a place-holder for a loading record, rather than a valid record. Can't continue: "\r\n CalendarView.getVisibleEvents(_1=>null)\r CalendarView.refreshVisibleEvents(_1=>null, _2=>null, _3=>\"refreshEvents\")\r CalendarView.refreshEvents()\r Calendar.refreshSelectedView()\r Calendar.dataChanged()\r anonymous(operationType=>undef, originalRecord=>undef, rowNum=>undef, updateData=>undef, filterChanged=>undef, dataFromCache=>undef)\r thunk(operationType=>undef, originalRecord=>undef, rowNum=>undef, updateData=>undef, filterChanged=>undef, dataFromCache=>undef)\r dataChangedObservation(undef, undef, undef, undef, undef, undef)\r ResultSet.$ee(_1=>undef, _2=>undef)\r ResultSet.$390(_1=>Array[75], _2=>Obj)\r ResultSet.fetchRemoteDataReply(dsResponse=>Obj, data=>Array[75], request=>Obj)\r [c]Class.fireCallback(_1=>Obj, _2=>\"dsResponse,data,dsRequest\", _3=>Array[3], _4=>[DataSource ID:schedule], _5=>undef)\r [a]MathFunction.fireCallback(_1=>Obj, _2=>\"dsResponse,data,dsRequest\", _3=>Array[3], _4=>undef)\r DataSource.fireResponseCallbacks(_1=>Obj, _2=>Obj, _3=>Obj, _4=>Obj)\r DataSource.$38b(_1=>Array[75], _2=>Obj, _3=>Obj, _4=>Obj, _5=>Obj)\r DataSource.$50h(_1=>Obj, _2=>Array[75], _3=>Obj)\r ** recursed on [c]Class.fireCallback\r"
com.smartgwt.client.core.JsObject$SGWT_WARN: 23:36:10.686:XRP2:WARN:TimelineView:isc_MyScheduleTimeline_0_timelineView:timeline.getVisibleEvents() encountered a place-holder for a loading record, rather than a valid record. Can't continue: "\r\n CalendarView.getVisibleEvents(_1=>null)\r CalendarView.refreshVisibleEvents(_1=>null, _2=>null, _3=>\"refreshEvents\")\r CalendarView.refreshEvents()\r Calendar.refreshSelectedView()\r Calendar.dataChanged()\r anonymous(operationType=>undef, originalRecord=>undef, rowNum=>undef, updateData=>undef, filterChanged=>undef, dataFromCache=>undef)\r thunk(operationType=>undef, originalRecord=>undef, rowNum=>undef, updateData=>undef, filterChanged=>undef, dataFromCache=>undef)\r dataChangedObservation(undef, undef, undef, undef, undef, undef)\r ResultSet.$ee(_1=>undef, _2=>undef)\r ResultSet.$390(_1=>Array[75], _2=>Obj)\r ResultSet.fetchRemoteDataReply(dsResponse=>Obj, data=>Array[75], request=>Obj)\r [c]Class.fireCallback(_1=>Obj, _2=>\"dsResponse,data,dsRequest\", _3=>Array[3], _4=>[DataSource ID:schedule], _5=>undef)\r [a]MathFunction.fireCallback(_1=>Obj, _2=>\"dsResponse,data,dsRequest\", _3=>Array[3], _4=>undef)\r DataSource.fireResponseCallbacks(_1=>Obj, _2=>Obj, _3=>Obj, _4=>Obj)\r DataSource.$38b(_1=>Array[75], _2=>Obj, _3=>Obj, _4=>Obj, _5=>Obj)\r DataSource.$50h(_1=>Obj, _2=>Array[75], _3=>Obj)\r *

Strange error when adding backgroundlistener to timeline

$
0
0
Hello. I want to have my own editor to popup when clicking in my timeline, so i have added listeners to the plus-button. I have also added an eventclickhandler.

These two work fine, but i also want my custom editor when clicking in the background where there is no event. I have therefor tried to just add a "background" clickhandler that only does SC.say(), like this:
Code:

timeline.addBackgroundClickHandler(new BackgroundClickHandler() {
            @Override
            public void onBackgroundClick(BackgroundClickEvent backgroundClickEvent) {
                SC.say("HELLO!!");
                //backgroundClickEvent.cancel();
            }
        });

However, when i click on various locations in my timeline background, i only get the sc.say sometimes. A lot of times i get very weird errors in the module log.

I am unsure how to deal with this, but it feels unlikely to be something wrong with my clickhandler.

Trace below (5.0-p20150808, Firefox and Chrome):

ERROR: 23:48:10.349:MUP9:WARN:Log:Uncaught JavaScript exception: TypeError: _8 is undefined in http://127.0.0.1:8888/xxxx/sc/modules/ISC_Calendar.js, line 310
com.smartgwt.client.core.JsObject$SGWT_WARN: 23:48:10.349:MUP9:WARN:Log:Uncaught JavaScript exception: TypeError: _8 is undefined in http://127.0.0.1:8888/xxxx/sc/modules/ISC_Calendar.js, line 310
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:304)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
at com.smartgwt.client.util.SC.logWarn(SC.java)
at com.smartgwt.client.util.LogUtil.handleOnError(LogUtil.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
at java.lang.Thread.run(Thread.java:695)
ERROR: 23:48:17.825:MUP6:WARN:Log:TypeError: _8 is undefined
Stack from error.stack:
TimelineView.cellMouseUp() @ xxxx/sc/modules/ISC_Calendar.js:310
anonymous() @ nuba/sc/modules/ISC_Core.js:77
GridRenderer.mouseUp() @ xxxx/sc/modules/ISC_Grids.js:692
[a]MathFunction.invokeSuper() @ xxxx/sc/modules/ISC_Core.js:281
[a]MathFunction.Super() @ xxxx/sc/modules/ISC_Core.js:273
GridBody.mouseUp() @ xxxx/sc/modules/ISC_Grids.js:830
Canvas.handleMouseUp() @ xxxx/sc/modules/ISC_Core.js:2822
[c]EventHandler.bubbleEvent() @ xxxx/sc/modules/ISC_Core.js:1570
EventHandler._handleMouseUp() @ xxxx/sc/modules/ISC_Core.js:1412
[c]EventHandler.handleMouseUp() @ xxxx/sc/modules/ISC_Core.js:1407
[c]EventHandler.dispatch() @ xxxx/sc/modules/ISC_Core.js:1645
anonymous() @ xxxx/sc/modules/ISC_Core.js:76

DynamicForm width bug with many FormItems in 1 row / 2nd title-column titleWidth bug

$
0
0
Hi Isomorphic,

please see this testcase and attached screenshot:
Code:

package com.smartgwt.sample.client;

import java.util.Date;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
import com.smartgwt.client.core.KeyIdentifier;
import com.smartgwt.client.data.AdvancedCriteria;
import com.smartgwt.client.data.Criterion;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.types.AutoFitWidthApproach;
import com.smartgwt.client.types.OperatorId;
import com.smartgwt.client.types.ReadOnlyDisplayAppearance;
import com.smartgwt.client.util.DateDisplayFormatter;
import com.smartgwt.client.util.DateUtil;
import com.smartgwt.client.util.PageKeyHandler;
import com.smartgwt.client.util.Page;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Button;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.DateChooser;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.BooleanItem;
import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
import com.smartgwt.client.widgets.form.fields.DateItem;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.FormItemIcon;
import com.smartgwt.client.widgets.form.fields.HiddenItem;
import com.smartgwt.client.widgets.form.fields.LinkItem;
import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.SpinnerItem;
import com.smartgwt.client.widgets.form.fields.TextAreaItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.events.FormItemClickHandler;
import com.smartgwt.client.widgets.form.fields.events.FormItemIconClickEvent;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.SectionHeader;
import com.smartgwt.client.widgets.layout.SectionStack;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.tab.TabSet;

public class BuiltInDS implements EntryPoint {
        private VLayout vL;
        private TestForm tF;
        private TestWindow tW;
        private HLayout hL;

        public void onModuleLoad() {
                DefaultApperanceSetter.setDefaultApperance();
                KeyIdentifier debugKey = new KeyIdentifier();
                debugKey.setCtrlKey(true);
                debugKey.setKeyName("D");

                Page.registerKey(debugKey, new PageKeyHandler() {
                        public void execute(String keyName) {
                                SC.showConsole();
                        }
                });

                vL = new VLayout(5);
                vL.setTop(20);
                vL.setLeft(20);
                vL.setWidth100();
                vL.setHeight100();

                hL = new HLayout(5);

                IButton showWindow = new IButton("Show window");
                showWindow.setWidth(200);
                showWindow.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                                tW = new TestWindow();
                                tW.show();
                        }
                });

                hL.addMembers(showWindow);
                vL.addMembers(hL);
                vL.draw();
        }

        private class TestForm extends DynamicForm {
                public TestForm() {
                        super();
                        setDataSource(DataSource.get("supplyItem"));
                        setAutoFetchData(false);
                        setWidth("95%");
                        setTitleWidth(180);
                        setCellPadding(7);
                        setCanEdit(true);
                        setNumCols(6);

                        HiddenItem itemID = new HiddenItem("itemID");
                        itemID.setFetchMissingValues(false);

                        // 2 Items (2, 2) + 2x Title
                        final TextItem itemNameTI = new TextItem("itemName");
                        itemNameTI.setRequired(true);
                        itemNameTI.setColSpan(2);

                        TextItem sku = new TextItem("SKU");
                        sku.setColSpan(2);
                        FormItemIcon icon = new FormItemIcon();
                        icon.setSrc("[SKINIMG]Dialog/say.png");
                        icon.addFormItemClickHandler(new FormItemClickHandler() {
                                @Override
                                public void onFormItemClick(FormItemIconClickEvent event) {
                                        SC.say("<b>Lore ipsum...:</b>");
                                }
                        });
                        sku.setIcons(icon);

                        // 2 Items (2, 2) + 2x Title
                        final TextItem itemNameTI2 = new TextItem("itemName");
                        itemNameTI2.setRequired(true);
                        itemNameTI2.setColSpan(2);

                        TextItem sku2 = new TextItem("SKU");
                        sku2.setColSpan(2);
                        sku2.setTitle("Long Long SKU title");
                        FormItemIcon icon2 = new FormItemIcon();
                        icon2.setSrc("[SKINIMG]Dialog/say.png");
                        icon2.addFormItemClickHandler(new FormItemClickHandler() {
                                @Override
                                public void onFormItemClick(FormItemIconClickEvent event) {
                                        SC.say("<b>Lore ipsum2...:</b>");
                                }
                        });
                        sku2.setIcons(icon2);

                        // 3 Items (1,1,3) + 1x Title
                        SpinnerItem unitCostSI = new SpinnerItem("unitCost");
                        unitCostSI.setTitle("3 fields here");
                        unitCostSI.setShowHintInField(true);
                        unitCostSI.setHint("Fake title here");

                        SpinnerItem unitCostSI2 = new SpinnerItem("unitCost");
                        unitCostSI2.setShowTitle(false);
                        unitCostSI2.setShowHintInField(true);
                        unitCostSI2.setHint("Fake title here");

                        final TextItem descTI = new TextItem("description");
                        descTI.setColSpan(3);
                        descTI.setShowTitle(false);
                        descTI.setShowHintInField(true);
                        descTI.setHint("Fake title2 here");

                        // 2 Items (2,3) + 1x Title
                        SpinnerItem unitCostSI3 = new SpinnerItem("unitCost");
                        unitCostSI3.setColSpan(2);
                        unitCostSI3.setTitle("2 fields here");
                        unitCostSI3.setShowHintInField(true);
                        unitCostSI3.setHint("Fake title here");

                        final ComboBoxItem descCBI = new ComboBoxItem("description");
                        descCBI.setColSpan(3);
                        descCBI.setShowTitle(false);
                        descCBI.setShowHintInField(true);
                        descCBI.setHint("Fake title2 here");

                        setFields(itemID, itemNameTI, sku, itemNameTI2, sku2, unitCostSI, unitCostSI2, descTI, unitCostSI3, descCBI);
                        fetchData(new AdvancedCriteria(new Criterion("itemID", OperatorId.EQUALS, 1)));
                }
        }

        private class TestWindow extends Window {
                public TestWindow() {
                        super();
                        setPadding(0);
                        setMargin(0);
                        setMembersMargin(0);

                        setModalMaskOpacity(60);
                        setWidth(750);
                        setHeight(700);
                        setPadding(105);
                        setTitle("New Window");
                        setShowMinimizeButton(false);
                        setIsModal(true);
                        setShowModalMask(true);
                        setShowHeaderIcon(true);
                        centerInPage();

                        tF = new TestForm();
                        addItem(tF);
                }
        }

        private static class DefaultApperanceSetter {
                public static ReadOnlyDisplayAppearance defaultReadOnlyDisplayAppearance = ReadOnlyDisplayAppearance.DISABLED;
                private static Integer defaultFormItemHeight = 34;
                private static Integer defaultHoverDelay = 500;

                public static void setDefaultApperance() {
                        setShortDatetimeDisplayFormatter();
                        setFormItemDefaultApperance();

                        setBooleanItemDefaultApperance();
                        setButtonDefaultApperance();
                        setCanvasDefaultApperance();
                        setComboBoxItemDefaultApperance();
                        setDateItemDefaultApperance();
                        setDatePickerDefaultAppearance();
                        setDynamicFormDefaultApperance();
                        setLinkItemDefaultApperance();
                        setListGridDefaultApperance();
                        setSectionHeaderDefaultApperance();
                        setSectionStackDefaultApperance();
                        setSelectItemDefaultApperance();
                        setSpinnerItemDefaultApperance();
                        setTabSetDefaultApperance();
                        setTextAreaItemDefaultApperance();
                        setTextItemDefaultApperance();
                        setWindowDefaultApperance();
                }

                private static void setBooleanItemDefaultApperance() {
                        BooleanItem bi = new BooleanItem() {
                                {
                                        setWidth("*");
                                        setHeight(defaultFormItemHeight);
                                        setLabelAsTitle(true);
                                }
                        };
                        BooleanItem.setDefaultProperties(bi);
                }

                private static void setButtonDefaultApperance() {
                        Button b = new Button() {
                                {
                                        setHoverDelay(defaultHoverDelay);
                                }
                        };
                        Button.setDefaultProperties(b);
                }

                private static void setCanvasDefaultApperance() {
                        Canvas c = new Canvas() {
                                {
                                        // setGroupBorderCSS("color: black");
                                }
                        };
                        Canvas.setDefaultProperties(c);
                }

                private static void setComboBoxItemDefaultApperance() {
                        ComboBoxItem cbi = new ComboBoxItem() {
                                {
                                        setWidth("*");
                                        setHeight(defaultFormItemHeight);
                                        setCanSelectText(true);
                                }
                        };
                        ComboBoxItem.setDefaultProperties(cbi);
                }

                private static void setDateItemDefaultApperance() {
                        DateItem cbi = new DateItem() {
                                {
                                        // setWidth("*");
                                        setHeight(defaultFormItemHeight);
                                        setCanSelectText(true);
                                }
                        };
                        DateItem.setDefaultProperties(cbi);
                }

                private static void setDatePickerDefaultAppearance() {
                        DateChooser dp = new DateChooser() {
                                {
                                        setBackgroundColor("#C9C9C9");
                                        setEdgeCenterBackgroundColor("#C9C9C9");
                                        setGroupLabelBackgroundColor("#C9C9C9");
                                        setEdgeBackgroundColor("#C9C9C9");
                                        setStyleName("dateChooser");
                                        setBorder("0px");
                                        setGroupBorderCSS("0px");
                                }
                        };
                        DateChooser.setDefaultProperties(dp);
                }

                private static void setDynamicFormDefaultApperance() {
                        DynamicForm df = new DynamicForm() {
                                {
                                        setReadOnlyDisplay(DefaultApperanceSetter.defaultReadOnlyDisplayAppearance);
                                        // setCanSelectText(false);
                                        setTitleSuffix(":");
                                        setRequiredTitleSuffix(" (*):");
                                }
                        };
                        DynamicForm.setDefaultProperties(df);
                }

                private static void setFormItemDefaultApperance() {
                        FormItem fi = new FormItem() {
                                {
                                        setHeight(defaultFormItemHeight);
                                        setHoverDelay(defaultHoverDelay);
                                        setCanSelectText(true);
                                }
                        };
                        FormItem.setDefaultProperties(fi);
                }

                private static void setLinkItemDefaultApperance() {
                        LinkItem li = new LinkItem() {
                                {
                                        setWidth("*");
                                        setHeight(defaultFormItemHeight);
                                        setCanSelectText(true);
                                }
                        };
                        LinkItem.setDefaultProperties(li);
                }

                private static void setListGridDefaultApperance() {
                        ListGrid lg = new ListGrid() {
                                {
                                        setAutoFitFieldsFillViewport(true);
                                        setShowClippedValuesOnHover(true);
                                        setAutoFitWidthApproach(AutoFitWidthApproach.VALUE);
                                        setCanMultiGroup(false);
                                        setCanEdit(false);
                                        setShowFilterEditor(false);
                                        setCanFreezeFields(false);
                                        setCanReorderFields(false);
                                        setCellHeight(30);
                                        setHeaderHeight(35);
                                        setFixedRecordHeights(true);
                                        setGroupIcon("[SKINIMG]LT/group/group.png");
                                        setGroupIconSize(30);
                                        setGroupLeadingIndent(0);
                                        setHoverDelay(defaultHoverDelay);
                                }
                        };
                        ListGrid.setDefaultProperties(lg);
                }

                private static void setSectionHeaderDefaultApperance() {
                        SectionHeader sh = new SectionHeader() {
                                {
                                        setIconHeight(39);
                                        setIconWidth(39);
                                }
                        };
                        SectionHeader.setDefaultProperties(sh);
                }

                private static void setSectionStackDefaultApperance() {
                        SectionStack ss = new SectionStack() {
                                {
                                        setHeaderHeight(39);
                                        setCanResizeSections(false);
                                }
                        };
                        SectionStack.setDefaultProperties(ss);
                }

                private static void setSelectItemDefaultApperance() {
                        SelectItem si = new SelectItem() {
                                {
                                        setWidth("*");
                                        setHeight(defaultFormItemHeight);
                                        setCanSelectText(true);
                                }
                        };
                        SelectItem.setDefaultProperties(si);
                }

                private static void setShortDatetimeDisplayFormatter() {
                        DateUtil.setShortDatetimeDisplayFormatter(new DateDisplayFormatter() {
                                public String format(Date date) {
                                        if (date == null)
                                                return null;
                                        // final DateTimeFormat dateFormatter =
                                        // DateTimeFormat.getFormat("dd.MM.yyyy HH:mm");
                                        final DateTimeFormat dateFormatter = DateTimeFormat.getFormat(PredefinedFormat.DATE_MEDIUM);
                                        String format = dateFormatter.format(date);
                                        return format;
                                }
                        });
                }

                private static void setSpinnerItemDefaultApperance() {
                        SpinnerItem cbi = new SpinnerItem() {
                                {
                                        setWidth("*");
                                        setHeight(defaultFormItemHeight);
                                        setCanSelectText(true);
                                }
                        };
                        SpinnerItem.setDefaultProperties(cbi);
                }

                private static void setTabSetDefaultApperance() {
                        TabSet ts = new TabSet() {
                                {
                                        setTabBarThickness(35);
                                }
                        };
                        TabSet.setDefaultProperties(ts);
                }

                private static void setTextItemDefaultApperance() {
                        TextItem ti = new TextItem() {
                                {
                                        setWidth("*");
                                        setHeight(defaultFormItemHeight);
                                        setCanSelectText(true);
                                }
                        };
                        TextItem.setDefaultProperties(ti);
                }

                private static void setTextAreaItemDefaultApperance() {
                        TextAreaItem tai = new TextAreaItem() {
                                {
                                        setWidth("*");
                                        setReadOnlyDisplay(ReadOnlyDisplayAppearance.READONLY);
                                }
                        };
                        TextAreaItem.setDefaultProperties(tai);
                }

                private static void setWindowDefaultApperance() {
                        Window w = new Window() {
                                {
                                        setBackgroundColor("#F5F5F5");
                                        setBodyColor("#F5F5F5");
                                }
                        };
                        Window.setDefaultProperties(w);
                }
        }
}

As you can see in the screenshot, one SpinnerItem is not taking 50% of the possible place.
Also, the SKU-title is not as wide as the 1st title column.

My aim is to have not-so-wide and wide FormItems in the same form. In order not to squander place and keep the DynamicForm compact, I try to place narrow items belongs to each other next to each other (e.g. given name and surname).

I'm using v10.0p_2015-08-24/PowerEdition Deployment.

Best regards
Blama

Attached Images
File Type: png DynamicForm.png (12.7 KB)

Wrong(?) warning in Developer Console when saving ComboBoxItem selection

$
0
0
Hi Isomorphic,

please see this testcase (v10.0p_2015-08-24):
Code:

package com.smartgwt.sample.client;

import java.util.LinkedHashMap;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.core.KeyIdentifier;
import com.smartgwt.client.data.AdvancedCriteria;
import com.smartgwt.client.data.Criterion;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.types.OperatorId;
import com.smartgwt.client.util.PageKeyHandler;
import com.smartgwt.client.util.Page;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.HiddenItem;
import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;

public class BuiltInDS implements EntryPoint {
        private VLayout vL;
        private TestForm tF;
        private HLayout hL;

        public void onModuleLoad() {
                KeyIdentifier debugKey = new KeyIdentifier();
                debugKey.setCtrlKey(true);
                debugKey.setKeyName("D");

                Page.registerKey(debugKey, new PageKeyHandler() {
                        public void execute(String keyName) {
                                SC.showConsole();
                        }
                });

                vL = new VLayout(5);
                vL.setTop(20);
                vL.setLeft(20);
                vL.setWidth100();
                vL.setHeight100();

                tF = new TestForm(false);
                hL = new HLayout(5);

                IButton recreateCBI = new IButton("Recreate ComboBoxItem");
                recreateCBI.setWidth(200);
                recreateCBI.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                                vL.removeMember(tF);
                                tF.markForDestroy();
                                tF = new TestForm(false);
                                vL.addMember(tF, 0);
                        }
                });

                IButton recreateSI = new IButton("Recreate SelectItem");
                recreateSI.setWidth(200);
                recreateSI.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                                vL.removeMember(tF);
                                tF.markForDestroy();
                                tF = new TestForm(true);
                                vL.addMember(tF, 0);
                        }
                });

                IButton save = new IButton("Save");
                save.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                                tF.saveData();
                        }
                });

                hL.addMembers(recreateCBI, recreateSI, save);
                vL.addMembers(tF, hL);
                vL.draw();
        }

        private class TestForm extends DynamicForm {
                public TestForm(boolean useSelectItem) {
                        super();
                        setDataSource(DataSource.get("supplyItem"));
                        setAutoFetchData(false);
                        setWidth("95%");
                        setTitleWidth(180);
                        setCellPadding(7);
                        setCanEdit(true);
                        setNumCols(2);

                        HiddenItem itemID = new HiddenItem("itemID");
                        itemID.setFetchMissingValues(false);

                        // String[] and LinkedHashMap to demonstrate the bug
                        String[] valueList = { "1", "2", "5", "10" };
                        LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
                        for (String value : valueList)
                                valueMap.put("String:" + value, "String:" + value);

                        final TextItem itemNameTI = new TextItem("itemName");
                        final TextItem sku = new TextItem("SKU");

                        final FormItem unitCost;
                        final FormItem desc;

                        if (!useSelectItem) {
                                // Bug
                                unitCost = new ComboBoxItem("unitCost");
                                unitCost.setValueMap(valueList);
                                // Bug
                                desc = new ComboBoxItem("description");
                                desc.setValueMap(valueMap);
                        } else {
                                // OK
                                unitCost = new SelectItem("unitCost");
                                unitCost.setValueMap(valueList);
                                // OK
                                desc = new SelectItem("description");
                                desc.setValueMap(valueMap);
                        }

                        setFields(itemID, itemNameTI, sku, unitCost, desc);
                        fetchData(new AdvancedCriteria(new Criterion("itemID", OperatorId.EQUALS, 1)));
                }
        }
}

If you change the ComboBoxItem selection and save, you'll let the following Developer Console logs:
Code:

06:30:58.495:XRP7:WARN:fetchMissingValues:isc_ComboBoxItem_10[description]:Deriving valueMap for 'description' from dataSource based on displayField 'undefined'. This dataSource contains more than one record with description set to String:10 with differing undefined values. Derived valueMap is therefore unpredictable.
06:31:05.305:XRP0:WARN:fetchMissingValues:isc_ComboBoxItem_10[description]:Deriving valueMap for 'description' from dataSource based on displayField 'undefined'. This dataSource contains more than one record with description set to String:10 with differing undefined values. Derived valueMap is therefore unpredictable.
06:31:05.324:XRP0:WARN:fetchMissingValues:isc_ComboBoxItem_9[unitCost]:Deriving valueMap for 'unitCost' from dataSource based on displayField 'undefined'. This dataSource contains more than one record with unitCost set to 1 with differing undefined values. Derived valueMap is therefore unpredictable.

For me, it does not always happen for both ComboBoxItems, but always for at least one.
It does not happen at all for SelectItems.

Best regards
Blama

Backspace not working properly when apply keyPressFilter

$
0
0
Hi,
When apply keyPressFilter in a textitem which has defaultValue, pressing back space key won't work when there is one last character left. The code below modified from http://www.smartclient.com/#formFilters to illustrate the problem.

Code:

isc.DynamicForm.create({
    fields: [
        {name: "name",
        title: "Name",
        type: "text",
        hint: "Mapped to uppercase",
        width: 200,
        characterCasing: "upper"
        },
        {name: "commission",
        title: "Commission",
        type: "text",
        defaultValue: 800,
        hint: "Numeric only [0-9.]",
        width: 100,
        keyPressFilter: "[0-9.]"
        }
    ]
});

Viewing all 4756 articles
Browse latest View live