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

Paged TreeGrid-Nodes hides and show while opening a node

$
0
0
Hi there,
I'm currently testing SmartClient_v100p_2015-04-27_Pro, and I found a visual bug using paged TreeGrids.
Sorry for reporting another paged-treegrid related issue.

I'm trying to use all features of the treegrid, so now in order to reduce the count of the datasource-requests the datasource can also return open nodes and the children of the nodes simultaneously. The code example below and the used datasource are only for reproducibility. It isn't our real backend, but it does the job to report the issues, which I have detected using the paged-datasource in our application.
To not interfere with the bugfixing of the other thread i have copied the datasource, to enable the "canReturnOpenSubfolder"-feature combined with the childCount.

What the example does:
It returns for the root-node all childNodes with all their childNodes.
Using a paged TeeGrid also the childCount-property is set for each node.
In the initial-server-respone there are all "root-x" and their child-nodes "root-x-y" returned. The nodes "root-x-y" have the childCount-Property set, so the tree does already know how many childnodes will be gathered by the datasource, if the user tries to open "root-x-y".

The problem like shown below in the gif is, that opening a "root-x-y" nodes results in hiding all nodes, which are below that node. After the loading is finished and the childnodes of "root-x-y" are displayed all childnodes are displayed again.
This is not really visible if you are testing on localhost. In the example a delay in line 86 is mandatory! Increasing the delay makes the effect more visible. Because the paged TreeGrid is only used if you have a large tree, a delay while requesting the child-nodes is natural.


Because I have already set the childCount, the tree should not hide the nodes below.
It's reproducable with the latest nightly build SmartClient_v100p_2015-04-27_Pro and all current browsers (IE, Chrome, Firefox).

This is the code to reproduce:
Code:

isc.VLayout.create({
        "ID" : "rootLayout_5",
        "width" : "100%",
        "height" : "100%",
        "autoDraw" : true,
        "hideUsingDisplayNone" : false,
        "leaveScrollbarGap" : false,
        "members" :
        [
                isc.TreeGrid.create({
                        "ID" : "theTreeGrid",
                        "width" : "100%",
                        "height" : "100%",
                        "selectionType" : "multiple",
                        "canEdit" : false,
                        "showFilterEditor" : false,
                        dataSource : isc.DataSource.create({
                                "fields" :
                                [{
                                                "name" : "treeGridGeneratedIndex",
                                                "primaryKey" : true,
                                                "hidden" : true,
                                                "canView" : false
                                        }, {
                                                "name" : "nameField",
                                                "title" : "Reason",
                                                "type" : "text"
                                        }, {
                                                "name" : "parentId",
                                                "rootValue" : "root",
                                                "foreignKey" : "treeGridGeneratedIndex",
                                                "hidden" : true
                                        }
                                ],
                                "dataFormat" : "json",
                                "dataURL" : "http://devset.de/treegrid2.php",
                                "transformRequest" : requestTransformer,
                                "transformResponse" : responseTransformer,
                                "recordXPath" : "\/resultData",
                                useHttpProxy : false
                        }),
                        dataProperties : {
                                openProperty : "isOpen",
                                childrenProperty : "children",
                                canReturnOpenFolders: true,
                                progressiveLoading : false
                        },
                        "autoFetchData" : true,
                        "dataPageSize" : 50,
                        "dataFetchMode" : "paged",
                        "selectionProperty" : "isSelected",
                        "fields" :
                        [{
                                        "name" : "nameField",
                                        "title" : "Reason",
                                        "type" : "text",
                                        "canEdit" : true,
                                        "canSort" : true
                                }, {
                                        "name" : "lastField",
                                        "title" : "Name",
                                        "type" : "text",
                                        "canEdit" : true,
                                        "canSort" : true
                                }, {
                                        "name" : "randomField",
                                        "title" : "random",
                                        "type" : "text",
                                        "canEdit" : true,
                                        "canSort" : true
                                }
                        ],
                        "selectionProperty" : "isSelected",
                        "members" :
                        []
                })
        ]
});
function requestTransformer(dataSourceRequest) {
        var operationType = {
                operationType : dataSourceRequest.operationType
        };
        if (dataSourceRequest.operationType == "fetch") {
                var params = {
                        delay: 300,
                        sortBy : dataSourceRequest.sortBy,
                        start : dataSourceRequest.startRow,
                        end : dataSourceRequest.endRow
                };
        }
        return isc.addProperties({}, operationType, dataSourceRequest.data, params);
}
function responseTransformer(dataSourceResponse, dataSourceRequest, jsonData) {
        if (dataSourceRequest.operationType == "fetch") {
                dataSourceResponse.totalRows = jsonData.totalRows;
                dataSourceResponse.endRow = jsonData.endRow;
                dataSourceResponse.startRow = jsonData.startRow;
        };
}

Best Regards

DynamicForm.setCanEdit(false) and declarative field-level canEdit bug

$
0
0
Hi Isomorphic,

please see this testcase (v10.0p_2015-04-23):
BuiltInDS.java:
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.Criteria;
import com.smartgwt.client.data.DSCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.util.PageKeyHandler;
import com.smartgwt.client.util.Page;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.SpinnerItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.layout.VStack;

public class BuiltInDS implements EntryPoint {
        private DynamicForm boundForm;
        private SelectItem foobar;
        private SpinnerItem salary;
        private TextItem orgUnit;
        private SelectItem gender;

        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();
                        }
                });

                VStack vStack = new VStack();
                vStack.setLeft(175);
                vStack.setTop(75);
                vStack.setWidth("70%");
                vStack.setMembersMargin(20);

                boundForm = new DynamicForm() {
                        {
                                setDataSource(DataSource.get("employees"));
                                setCanEdit(false);

                                foobar = new SelectItem("GenderCSE");
                                LinkedHashMap<String, String> hm = new LinkedHashMap<String, String>();
                                hm.put("F", "Foo");
                                hm.put("B", "Bar");
                                hm.put("FB", "Foobar");
                                foobar.setValueMap(hm);
                                salary = new SpinnerItem("Salary");
                                orgUnit = new TextItem("OrgUnit");
                                gender = new SelectItem("Gender");

                                setFields(foobar, salary, orgUnit, gender);
                        }
                };
                vStack.addMember(boundForm);
                vStack.draw();
                boundForm.fetchData(new Criteria("EmployeeId", "4"), new DSCallback() {
                        @Override
                        public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) {
                                foobar.setValue("B");
                        }
                });
        }
}

employees.ds.xml addition:
Code:

<field name="GenderCSE" title="GenderCSE" canSave="false" canEdit="true" customSelectExpression="Gender" />
I have a similar setup in my application:
  • The readOnly-setting is dependent on how the form is called.
  • The field GenderCSE is never saved (not available as column in the DB), but only a customSelectExpression. Therefore is is defined in .ds.xml as canSave="false" canEdit="true". This is because I have event handlers on it and if I omit the canEdit="true", it is always non-editable because of the canSave="false".
  • Now, if I call the DynamicForm with setCanEdit(false) the foobar-SelectItem is enabled nevertheless.
  • This makes it possible for the user to use the field and also fire the onChange-event handlers, which I do not want.
  • My expectation is that the foobar-field is - like all the other fields - enabled when DynamicForm.setCanEdit(true) and readOnly when DynamicForm.setCanEdit(false).

Best regards
Blama

Few smartGWT controls are not working in "Project Spartan" browser.

$
0
0
Hi Isomorphic,

Thank you for your support.

I am using Smart Gwt-4.1p (29th Oct 2014)
Browser: Google chrome 39.0.2171.95 m, IE8 and IE9

During evaluation of my application in "Project Spartan browser"(which is deployed in Window 10 Tech preview), I found that following smartGWT controls are not working properly.

issues:
1. Tooltips and validation(Error) messages are not displayed.
Issue:
Tooltips and validation messages are not displayed in "Spartan" browser.Please find the attached screen shots for your reference.
File Name:
ToolTipAndValidations.jpg
Showcase URL:
http://www.smartclient.com/smartgwt/...orm_type_reuse
http://www.smartclient.com/smartgwt/...raction_hovers


2. Treegrid not opened by giving single click.
Showcase URL: http://www.smartclient.com/smartgwt/...ured_tree_grid.


3. Column menu icon is not displayed.
Issue:
column menu icon is not displayed in "Spartan" browser.Please find the attached screen shots for your reference.
File Name:
IconNotDisplayed.jpg
Showcase URL:
http://www.smartclient.com/smartgwt/...form_grid_item

Please let us know whether SMARTGWT have any plans to provide support for “Spartan browser” in further.

Regards,

Attached Images
File Type: jpg ToolTipAndValidations.jpg (20.6 KB)
File Type: jpg IconNotDisplayed.jpg (70.5 KB)

TextAreaItem + ReadOnlyDisplayAppearance.DISABLED inconsistent browser behaviour

$
0
0
Hi Isomorphic,

please see the following test case (SNAPSHOT_v10.1d_2015-04-09, Simplicity skin):
Code:

package com.smartgwt.sample.client;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.core.KeyIdentifier;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.types.ReadOnlyDisplayAppearance;
import com.smartgwt.client.util.PageKeyHandler;
import com.smartgwt.client.util.Page;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
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.layout.VStack;

public class BuiltInDS implements EntryPoint {
        private DynamicForm boundForm;
        private TextItem scientificName;
        private TextItem commonName;
        private SelectItem status;
        private ComboBoxItem status2;
        private SpinnerItem lifeSpan;
        private TextAreaItem information;

        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();
                        }
                });

                VStack vStack = new VStack();
                vStack.setLeft(175);
                vStack.setTop(75);
                vStack.setWidth("70%");
                vStack.setMembersMargin(20);

               
                boundForm = new DynamicForm() {
                        {
                                setDataSource(DataSource.get("animals"));
                                setReadOnlyDisplay(ReadOnlyDisplayAppearance.DISABLED);
                                setCanEdit(false);

                                commonName = new TextItem("commonName");
                                scientificName = new TextItem("scientificName");
                                status = new SelectItem("status");
                                status2 = new ComboBoxItem("status");
                                lifeSpan = new SpinnerItem("lifeSpan");
                                information = new TextAreaItem("information");
                                information.setHeight(100);
                                setFields(commonName, scientificName, status, status2, lifeSpan, information);
                        }
                };
                vStack.addMember(boundForm);
                vStack.draw();
                boundForm.fetchData(new Criteria("scientificName", "Loxodonta africana"));
        }
}

For me, the information-TextAreaItem behaves differently in browsers:
  • FF26: Scrolling disabled via scrollbars and mouse-wheel and mouse-click-text-select-draw.
  • GC42: Scrolling disabled mouse-wheel and mouse-click-text-select-draw. Scrollbars enabled.
  • IE11: Scrolling disabled via scrollbars and mouse-wheel. Enabled via mouse-click-text-select-draw.
I like the GC behaviour the best.

Best regards
Blama

ReadOnlyDisplayAppearance behaviour: Best mode missing (disabled + c&p + scrolling)

$
0
0
Hi Isomorphic,

IMHO the best mode for read-only FormItems is missing from the configuration options:
  • Default-ReadOnlyDisplayAppearance.READONLY is missing visual pointers to the read-only nature of the items
  • ReadOnlyDisplayAppearance.DISABLED also disables copy&paste (and perhaps scrolling)
  • ReadOnlyDisplayAppearance.STATIC takes away information about the nature of an item (e.g.: free-entry or dropdown? text or "real" date?) and gives an "unknown" UI to a user who also knows the readWrite-version of the form.
A setting of ReadOnlyDisplayAppearance.DISABLED plus copy and paste and easy scrolling via mousewheel and scrollbars would be the best behaviour for me. I'd say it is not possible to use anything else than ReadOnlyDisplayAppearance.DISABLED currently for the reasons given. But then the no-copy&paste is annoying and the no-scrolling (which might be a bug) is perceived as UI defect (happened to me).

I'm using current 5.0p/5.1d.

Best regards
Blama

PS: You removed the "start as disabled"-mode from the online showcase. I'm sure you have reasons for this, but it would make testing easier.

Strange calendar behavior

$
0
0
Hi,

Here a small test case which reproduces a problem I currently have with the calendar. Actually, when in the month view, and when you left click on a day which is grayed out (Sat/Sun for example), the scrollbars are shown and then hidden when the mouse button is released.

Code:

                Calendar                        calendar = new Calendar();
                calendar.setWidth100();
                calendar.setHeight100();
                calendar.show();

We are running SGWT 4.1p, v9.1p_2014-08-11/PowerEdition Deployment (built 2014-08-11)

Many thanks,
Thomas

ListGridField.setAutoFitWidth(false) has no impact on ListGrid context menu's autofit

$
0
0
Hi Isomorphic,

please see the attached test case ( + screenshots). I'm expecting the last columns to stay constant in width, which does not happen here (FF26, v10.0p_2015-04-23).

Code:

package com.smartgwt.sample.client;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.core.KeyIdentifier;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.types.AutoFitWidthApproach;
import com.smartgwt.client.util.PageKeyHandler;
import com.smartgwt.client.util.Page;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.layout.VStack;

public class BuiltInDS implements EntryPoint {
        private ListGrid boundList;
        private ListGridField scientificName;
        private ListGridField commonName;
        private ListGridField status;
        private ListGridField status2;
        private ListGridField lifeSpan;
        private ListGridField information;

        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();
                        }
                });

                VStack vStack = new VStack();
                vStack.setLeft(20);
                vStack.setTop(20);
                vStack.setWidth("95%");
                vStack.setHeight("95%");
                vStack.setMembersMargin(20);

                boundList = new ListGrid() {
                        {
                                setDataSource(DataSource.get("animals"));

                                commonName = new ListGridField("commonName");
                                commonName.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);

                                scientificName = new ListGridField("scientificName");
                                scientificName.setAutoFitWidthApproach(AutoFitWidthApproach.TITLE);

                                status = new ListGridField("status");
                                status.setAutoFitWidthApproach(AutoFitWidthApproach.VALUE);

                                status2 = new ListGridField("status");
                                status2.setWidth(50);
                                status2.setAutoFitWidth(false);

                                lifeSpan = new ListGridField("lifeSpan");
                                lifeSpan.setWidth(50);
                                lifeSpan.setAutoFitWidth(false);

                                information = new ListGridField("information");
                                information.setWidth(50);
                                information.setAutoFitWidth(false);
                               
                                setFields(commonName, scientificName, status, status2, lifeSpan, information);
                        }
                };
                vStack.addMember(boundList);
                vStack.draw();
                boundList.fetchData();
        }
}

Best regards,
Blama

Attached Images
File Type: png Before_Autofit.png (8.7 KB)
File Type: png After_Autofit.png (21.7 KB)

Calendar Event Display Code

$
0
0
I'm using SmartGWT 4.0 with GWT 2.7 for the Calendar widget feature. In that calendar widget month view if the list of events is too many to be displayed there is a "+ X more..." as the last item. Is there a way to display the entire list of (sometimes in the hundreds of) events as they all need to be displayed? Going into day or week view is not an option as this will be printed out.

I don't mind modifying the LGPL version if necessary and have even compiled SmartGWT 4.0 (couldn't get any others tags to compile). I've looked all through the widgets/calendar source code but I cannot find where to change this behaviour of the Calendar Widget.

I'm more than happy to provide any information that I can as necessary.

Unrecoverable error handling not behaving as expected

$
0
0
Version: v9.0_2013-07-03/LGPL Development Only
Browsers: Chrome, Firefox

Based on this snippet from http://www.smartclient.com/smartgwtee/javadoc/com/smartgwt/client/data/RestDataSource.html:

"An unrecoverable error, such as an unexpected server failure, can be flagged by setting <status> to -1 and setting <data> to an error message. In this case the <errors> element is not used (it's specific to validation errors). An unrecoverable error causes all response processing to be skipped and RPCManager.handleError() to be invoked, which by default will show the provided error message as an alert using isc.warn()."

I've set up my error response from the server in the form of:

{
"response" :{
"status" : -1,
"data" : "This is an error"
}
}

However, the client side behaviour is not as advertised. Rather than going into RPCManager.handleError(), it calls the callback method instead and a breakpoint at this time reveals that the status changes to '0' for some reason. And yes, in case you're going to ask, I've already set willHandleError to false.

Additionally, if I set data to null rather than the error string, the -1 status is maintained and RPCManager.handleError() is called.

Have I misunderstood the document? What is the proper response structure for unrecoverable errors?

Making UIMenuItem hidden using ui.xml

$
0
0
I have one ui.xml containing UIMenuItem. Our customer does not want the button now. But we dont want to touch any java code.
How to make this UIMenuItem hidden?


Rough Code:
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:smt="urn:import:org.synthful.smartgwt.client.widgets" xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:km="urn:import:com.consona.ckm.contenteditor.client.core.view">
<smt:UIToolStripMenuButton ui:field="btnSaveMenu">
<smt:UIMenuItem ui:field="submitMenuItem" title="{resources.submit}" />
</smt:UIToolStripMenuButton>


I want to make submitMenuItem invisible. I tried by adding visible="false". But does not seem to work.

Smartgwt version 4, Chrome browser.

Classic Dev Mode Debugger Broken in IE9 in Latest 5.1d Builds

$
0
0
The classic dev mode debugger seems to have stopped working in the more recent builds of 5.1d. It was working with prior builds of 5.1d from 3/29 and earlier. It fails at app start up time with the following exception below. The line of java code that triggers it is this:

schemaSet.getSchema(dsName);

We rely heavily on the classic dev more debugger as our main tool for debugging our app, since we have not made the switch yet to the Super Dev Mode debugger. So my question is: Is it broken due to a bug in the build, or is this due to support being dropped for this mode?

com.smartgwt.client.core.JsObject$SGWT_WARN: 13:23:46.051:TMR7:WARN:Log:Error:
'Exception thrown and not caught'
in http://localhost:8080/BAAWebApp/com.baa.AccountView/sc/modules/ISC_Core.js
at line 266

crashed in: [c]Class.fireCallback()

Use any version of Internet Explorer other than IE9 for best diagnostics, otherwise Firefox or Chrome
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.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:619)


SmartClient Version: SNAPSHOT_v10.1d_2015-04-22/LGPL Development Only (built 2015-04-22)

Filter based on the Grid summary

$
0
0
I have a set of records in my listgrid. Each records has unique item number(combination of 5 items numbers) with OH Units field.
I am using both filter and Group by option. Initially I am using a Group by where the OH Units is summed up to its group value

Eg., Before Grouping

Item Number OH Units
001-051-061-071-001 100
001-051-061-071-002 200
001-051-061-071-003 400

After Group by first four combinations, I get the below result.
Item Number OH Units
001-051-061-071 700

Case 1 : While applying filter for OH units > 650.
It shows no items to display

Case 2 : While applying filter for OH units > 350.
It shows only one record to display
Item Number OH Units
001-051-061-071-003 400

Case 2 : While applying filter for OH units > 90.
Item Number OH Units
001-051-061-071 700

I want filtering to be based on summary values shown below the grid and not on individual records.

Below is the query used for fetching the records. Based on the count value from the query the records are being displayed in the grid.

<operationBinding operationType="fetch" operationId="count">
<selectClause>count(*) as recordCount</selectClause>
<tableClause>
<![CDATA[
(select 1 as aGroup from
#if($isMultiBusinessFeatureEnabled)
IPITHDR JOIN IPIZHDR
ON IPIZHDR.IZONE=$zone AND IPITHDR.ICLS=IPIZHDR.ICLS AND IPITHDR.IVEN=IPIZHDR.IVEN
AND IPITHDR.ISTY=IPIZHDR.ISTY AND IPITHDR.ICLR=IPIZHDR.ICLR AND IPITHDR.ISIZ=IPIZHDR.ISIZ
#else IPITHDR #end

WHERE ($defaultWhereClause)
#if($rawValue.ItiuValue)
$rawValue.itiuclause

#if ($ViewRestrictedItems != "true" && $rawValue.restrictedItemsClause)
AND NOT ($rawValue.restrictedItemsClause)

#end

GROUP BY
#if ($GroupLevel == "style")
IPITHDR.ICLS, IPITHDR.IVEN, IPITHDR.ISTY, CASE WHEN IPITHDR.IPPK='Y' THEN 'Y' ELSE 'N' END
#elseif ($GroupLevel == "color")
IPITHDR.ICLS, IPITHDR.IVEN, IPITHDR.ISTY, IPITHDR.ICLR, CASE WHEN IPITHDR.IPPK='Y' THEN 'Y' ELSE 'N' END
#elseif ($GroupLevel == "item")
IPITHDR.ICLS, IPITHDR.IVEN, IPITHDR.ISTY, IPITHDR.ICLR, IPITHDR.ISIZ, CASE WHEN IPITHDR.IPPK='Y' THEN 'Y' ELSE 'N' END
#else ''
#end
) as work
]]>
</tableClause>
<whereClause>1 = 1</whereClause>
<groupClause>aGroup</groupClause>
</operationBinding>

I tried using addToTemplateContext for appending the condition from server side as a string. But got parsing error. Any suggestions ?

Filter a grid without using a datasource

$
0
0
Hi everyone,

I populate the grid using the code below and it works good.
Please see my code below.
Code:

        for(int i = 0 ; i < contractDateLs.size() ; i++)
                                {
                                       
                                        ListGridRecord record = new ListGridRecord();
                                                record.setAttribute("dateReserved",contractDateLs.get(i));
                                                record.setAttribute("receiptNumber",receiptNumLs.get(i));
                                                record.setAttribute("wholeName", clientNameLs.get(i));
                                                record.setAttribute("lotDetails", lotDetailsLs.get(i)); 
                                                record.setAttribute("broker_name", brokerLs.get(i)); 
                                               
                                                record.setAttribute("agent_name", agentLs.get(i));
                                                record.setAttribute("dueDate",dueDateLs.get(i)); 
                                                record.setAttribute("amount", amountLs.get(i));                                               
                                                record.setAttribute("lotsale", saleIdLs.get(i));                                               
                                                record.setAttribute("paymentId", paymentIdLs.get(i));                                               
                                                r.add(record);       
                                }               
                               
                                grid.setData(r);

I also have the code below.
Code:

                grid.setShowFilterEditor(true);
                grid.setFilterOnKeypress(true);
                grid.setFilterByCell(true);
                grid.setAutoFetchData(true);

and here are my ListGridFields.
Code:

ListGridField name = new ListGridField("wholeName", "Client Name");
                ListGridField details = new ListGridField("lotDetails", "Lot Details");
                ListGridField brokerName = new ListGridField("broker_name", "Broker");
                ListGridField agentName = new ListGridField("agent_name", "Agent");
                ListGridField totalAmount = new ListGridField("amount", "Amount Paid");
                ListGridField paymentDate = new ListGridField("dueDate", "Due Date");
                ListGridField systemReceipt = new ListGridField("receiptNumber", "System Receipt Number");
                ListGridField contractDate = new ListGridField("dateReserved", "Contract Date");
                ListGridField saleId = new ListGridField("lotsale", "Sale ID");
                ListGridField paymentId = new ListGridField("paymentId", "Payment ID");

My problem is when i try to filter a particular column.
Like for example the 'name' ListGridField, the filter has no effect.

Please help! Thanks.!

Using Dojo date picker/chooser in smartclient

$
0
0
Smarclient Version: v10.0p_2015-04-01/Enterprise Development Only

In our application, we want to use islamic(hijri) calendar in the date picker/chooser component to provide support for arabic language. Smartclient doesn't provide the support for hijri calendar. So, we want to use the date picker/chooser provided by the dojo which has islamic(hijri) calendar support.

How can we use date picker/chooser provided by dojo using smartclient framework?

[MiniDateRangeItem] Validation error title

$
0
0
Hi,

We use MiniDateRangeItem as a filterEditorType of ListGridField.
If to enter invalid date range than an error icon is displayed. But title of this icon shows html escaped text (see attached image).

That is the standard validation text which looks ok in showcase http://www.smartclient.com/smartgwt/showcase/#grid_daterange_filtering but is escaped in our case.

Is there a way how to fix that or we have to use a custom text message?

We use smartgwt-5.0p

Thank you.

Attached Images
File Type: png date_range_title.png (8.9 KB)

Bug in 5p latest Nightly: TimeLine With dataSource founds not Data by ID

$
0
0
Hello,

I have some issues with timelines which are bound to a datasource. I am trying to read data from a JSON Restful. This seems to work... the appointments appear in the timetable (5 Dates with 1 day duration, see Screenshot).

My problems now are as follows:
1.The endDate does not appear correctly in the edit mask or in the mouseover text. The date format in the JSON Source is the same as the startDate, so it should be possible to read the endDate.

2. When I move a date to another day via drag&drop the date disappears in the timeline.

3. When I click on the "X" for removing an appointment... nothing happens on the first click... on the second cklick I am getting an error message which says "clientOnly remove operation failed: unable to find matching record" and on the developer console I get the following error:

Code:

13:50:01.788:TMR3:WARN:RPCManager:clientOnly remove operation failed: unable to find matching recordundefined - response: {status: -1,
data: "clientOnly remove operation failed: unab..."[66],
httpResponseCode: undef,
httpResponseText: undef,
transactionNum: 56,
clientContext: Obj,
internalClientContext: undef,
httpHeaders: undef,
context: Obj,
startRow: 0,
endRow: 0,
totalRows: 0}


Timeline Example Code:
Code:

private void initTimeLine()
    {
        Date startDate = getMinTourStartDate();
        CalendarUtil.addDaysToDate( startDate, -1 );

        Date endDate = getMaxTourEndDate();
        CalendarUtil.addDaysToDate( endDate, 1 );

        HeaderLevel headerDays = new HeaderLevel( TimeUnit.DAY );
        headerDays.setHeaderWidth( 120 );
        headerDays.setTitleFormatter( new HeaderLevelTitleCustomizer()
        {

            @Override
            public String getTitle( HeaderLevel headerLevel, Date startDate, Date endDate, String defaultValue,
                                    Calendar calendar )
            {
                DateTimeFormat fmt = DateTimeFormat.getFormat( "EEE,dd.MMM" );
                return fmt.format( startDate );
            }
        } );

        HeaderLevel[] headerLevels = new HeaderLevel[] { new HeaderLevel( TimeUnit.WEEK ), headerDays };

        calendar = new Timeline();
        calendar.setWidth100();
        calendar.setHeight100();

        CAssignedTimeLineShows dsClass = new CAssignedTimeLineShows();
        calendar.setDataSource( dsClass.getDataSource( mainWindow.getSelectedIDs() ) );
        calendar.setAutoFetchData( true );

        calendar.setCanEditLane( false );
        calendar.setShowEventDescriptions( false );
        calendar.setHeaderLevels( headerLevels );
        calendar.setLaneFields( new ListGridField[] { new ListGridField( "title", "Name", 300 ) } );
        calendar.setLanes( getLanes() );
        calendar.setEndDateField( CAssignedTimeLineShows.endDate );
        calendar.setStartDateField( CAssignedTimeLineShows.startDate );
        calendar.setStartDate( startDate );
        calendar.setEndDate( endDate );
        calendar.setDisableWeekends( false );
    }

    private Lane[] getLanes()
    {
        ListGridRecord[] records = mainWindow.getSelectedRecords();
        Lane[] lanes = new Lane[records.length];

        for ( int i = 0; i < records.length; i++ )
        {
            String id = records[i].getAttribute( CItemSupplyTours.tour_id );
            String startDate =
                DateTimeFormat.getFormat( "dd.MM.yyyy" ).format( records[i].getAttributeAsDate( CItemSupplyTours.start_date ) );
            String endDate =
                DateTimeFormat.getFormat( "dd.MM.yyyy" ).format( records[i].getAttributeAsDate( CItemSupplyTours.end_date ) );

            String name =
                records[i].getAttribute( CItemSupplyTours.name ) + "<br>"
                    + records[i].getAttribute( CItemSupplyTours.artist_names ) + "<br>" + startDate + " - " + endDate;

            lanes[i] = new Lane( id, name );
        }

        return lanes;
    }

DataSource example code
Code:

import java.util.Date;

import com.google.gwt.core.client.GWT;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.fields.DataSourceDateTimeField;
import com.smartgwt.client.data.fields.DataSourceSequenceField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.types.DSDataFormat;

public class CAssignedTimeLineShows
{
    static String eventId = "eventId";
    static String name = "name";
    static String description = "description";
    static String startDate = "startDate";
    static String endDate = "endDate";
    static String lane = "lane";

    public DataSource getDataSource( String idValues )
    {
        DataSource ds = new DataSource();
        String dataUrl = GWT.getHostPageBaseURL() + "rest/shows/getAllShowsOfMultipleTours/" + idValues;
     

        ds.setDataURL( dataUrl );
        ds.setClientOnly( true );
        ds.setID( "timeline" );
        ds.setDataFormat( DSDataFormat.JSON );

        DataSourceSequenceField eventIdField = new DataSourceSequenceField( eventId );
        eventIdField.setPrimaryKey( true );
        DataSourceTextField nameField = new DataSourceTextField( name );
        DataSourceTextField descField = new DataSourceTextField( description );
        DataSourceDateTimeField startDateField = new DataSourceDateTimeField( startDate );
        DataSourceDateTimeField endDateField = new DataSourceDateTimeField( endDate );
        DataSourceTextField laneField = new DataSourceTextField( lane );

        ds.setFields( eventIdField, nameField, descField, startDateField, endDateField, laneField );

        return ds;
    }

}

The data arrive in JSON as follows:
Code:

"eventId":3005,
"lane":"144",
"name":"Paris",
"description":"Main Room"
"startDate":"2017-07-01T00:00:00.000+02:00",
"endDate":"2017-07-02T00:00:00.000+02:00"


Attached Images
File Type: png Screen1.png (6.6 KB)

Grid sorting with multiple columns

$
0
0
Hello,

there is a problem with sorting of a grid with multiple columns.

Field 1 is a field of type "date".
Field 2 is a numeric field with a sort normalizer.
=> The sorting can be incorrect.

The error is in ISC_Core.js (Version v10.0p_2015-04-28/Pro) in funtion sortByProperties from line 25763 to 25882:

Code:

        if (isc.isA.Function(normalizer)) {
...
                if (dataType != null && !Array._matchesType(item[this.sortProps[i]], dataType)) {
                    wrongTypeArray[i][ii] = item[this.sortProps[i]];
                }
...
        } else {
            // if not passed an explicit normalizer, choose the appropriate function to normalize data
            // (see above)
            var dataType = null;
...
dataType is set here in multiple lines
25806, 25825, 25833
...
                if (dataType != null && !Array._matchesType(atomicValue, baseType)) {
                    wrongTypeArray[i][ii] = item[this.sortProps[i]];
        }

When sorting, the first field runs into the else part and dataType is set to "date".
The second field runs into the normalizer part, but there is no setting of the dataType variable, so the value of it is "date". Because the type of the field isn't date, the wrongTypeArray value is set and later the field will be sort by the wrongTypeArray value and not by the normalized value.

Please fix it.

Regards

Peter

Display image in ListGrid without SmartGWT Server

$
0
0
I don't use SmartGWT Server, our server is a JBoss where we have implemented REST Web Services.

I will try to provide a small tutorial in order to :
- On server-side
* Read an image file as byte[]
* Convert byte[] to Base64 encoded String
* Add headers in order to display Image correctly on client side
- On client
* Display the image in the ListGridField of a databinded ListGrid

As I said, we have implemented REST Web Services on a JBoss EAP 6.1+. The implementation of a REST WS create DTO classes which are converted into JSON and then sent to client (Browser).
This part works perfectly fine, i will not detail it

-------------------
-- Server Side --
-------------------

In our REST WS, we read an image file

Code:

File file = new File("~/path/image.jpg");
FileInputStream fileInputStream = new FileInputStream(file);
imageFileAsByteArray = new byte[(int) file.length()];
fileInputStream.read(imageFileAsByteArray);
fileInputStream.close();

Then we encode the binary from byte[] to Base64 String.
I use Apache Commons Codec.

Code:

<dependency>
  <groupId>commons-codec</groupId>
  <artifactId>commons-codec</artifactId>
  <version>1.10</version>
</dependency>

Code:

String imageFileAsBase64 = new String(Base64.encodeBase64(imageFileAsByteArray));
In order to be display on client you must add headers to your Base64 String.
Let's assume the image file is a jpg.

Code:

String mimeType = "image/jpeg";
String headers = "data:" + mimeType + ";base64,";
String imagePayload = headers + imageFileAsBase64;

Others mimeType : http://www.sitepoint.com/web-foundations/mime-types-complete-list/

The imagePayload String is set as a parameter of a DTO class.
The DTO class is converted as JSON and return to client.

In our case, the parameter name of the DTO class is "imageFile".
That parameter name has to match databinded name on ListGridField on ListGrid in order to be automatically display in ListGrid.

-----------------
-- Client Side --
------------------

We declare several ListGridField and particularly one :

Code:

...
final ListGridField imageGridField = new ListGridField("imageFile");
imageGridField.setType(ListGridFieldType.IMAGE);
imageGridField.setShowFileInline(true);
...
grid.setFields(..., imageGridField, ...);


It works for me, if there is a better way to do that, please post it.

You may want to read more about image display/upload and Base64 encoded String when you don't use SmartGWT server :
http://forums.smartclient.com/showthread.php?t=32734

Mobile rotation problem

$
0
0
I am trying to use the splitPane component as the basis for a desktop/mobile application that I am developing.

It works fine on the desktop, but there is a screen scaling issue on the mobile device.

It occurs when you view the app in portrait mode, then orientate to landscape and finally orientate back to portrait.

The app changes scale so that the second time we go to portrait mode the size of everything has reduced.

The attached images show the following:
1.png: Initial app open in portrait mode
2.png: Rotate to landscape
3.png: Rotate back to portrait.

However, if I change the width of the splitPane to 90%, it seems to work as expected. ie. The scaling is correct when I go back to portrait mode to second time.


My software versions are as follows:
Smartclient version: SNAPSHOT_v10.1d_2015-04-28/LGPL Deployment
Mobile phone: Nexus 4
Android version: 5.1.0
Chrome version: 42.0.2311.109


Below is my source code for this example.

Code:


<HTML><HEAD>

<SCRIPT>var isomorphicDir="smartclientRuntime/isomorphic/";</SCRIPT>
<SCRIPT SRC=smartclientRuntime/isomorphic/system/modules/ISC_Core.js></SCRIPT>
<SCRIPT SRC=smartclientRuntime/isomorphic/system/modules/ISC_Foundation.js></SCRIPT>
<SCRIPT SRC=smartclientRuntime/isomorphic/system/modules/ISC_Containers.js></SCRIPT>
<SCRIPT SRC=smartclientRuntime/isomorphic/system/modules/ISC_Grids.js></SCRIPT>
<SCRIPT SRC=smartclientRuntime/isomorphic/skins/Graphite/load_skin.js></SCRIPT>
</HEAD>
<BODY>

    <script>


        isc.setAutoDraw(false);
      // Page.setEvent( "orientationChange","alert('orientationChange')"  );


        var splitPane = isc.SplitPane.create({
            autoDraw:true,
            navigationTitle:"Functions",
            showLeftButton:false,
            showRightButton:false,
            width: '100%',
            height: '100%'
        });


        var navigationPane = isc.VLayout.create ({
            members: [
                isc.Button.create({ title: "Function 1", click: function () { splitPane.showDetailPane() } }),
                isc.Button.create({ title: "Function 2", click: function () { splitPane.showDetailPane() } }),
                isc.Button.create({ title: "Function 3", click: function () { splitPane.showDetailPane() } }),
                isc.Button.create({ title: "Function 4", click: function () { splitPane.showDetailPane() } }),
            ]
        })

        var detailPane = isc.VLayout.create ({
            members: [
                isc.ListGrid.create({
                    ID: "countryList",
                    width: "100%",
                    height: "100%",
                    fields:[
                        {name:"countryCode", title:"Code"},
                        {name:"countryName", title:"Country"},
                        {name:"capital", title:"Capital"}
                    ],
                    data:[
                        {countryCode:"US", countryName:"United States", capital:"Washington, DC"},
                        {countryCode:"CH", countryName:"China", capital:"Beijing"},
                        {countryCode:"SP", countryName:"Spain", capital:"Madrid"},
                        {countryCode:"KS", countryName:"South Korea", capital:"Seoul"},
                        {countryCode:"ID", countryName:"Indonesia", capital:"Jakarta"}
                    ]
                })
            ]
        })


        splitPane.setDetailPane(detailPane);
        splitPane.setNavigationPane(navigationPane);

    </script>


</body>
</html>


Attached Images
File Type: png 1.png (10.9 KB)
File Type: png 2.png (11.6 KB)
File Type: png 3.png (8.5 KB)

ListGrid:setEditorCustomizer DateItem format issue

$
0
0
PROBLEM

setEditorCustomizer sort of works for a cell that has it's date explicitly set. I can make changes to that set cell and the format is in TOUSSHORTDATE. So my dates look like:
Code:

4/28/2015
However (here's the sort of works), when I change the date in another column (same row) whose value has not been set yet, then the date format changes to for example:
Code:

Tue Apr 28 12:00:00 2015
Then I go back to the original column with the explicitly set date and make a change, then I get:

Code:

Tue Apr 1 12:00:00 2015
So it seems that the date formatter changes from TOUSSHORTDATE to a different format. Note that in the code that I set the DateItem date formatter explicitly to TOUSSHORTDATE.

Please advise as to how I can keep the date formatter from changing.




1.SNAPSHOT_v10.1d_2015-04-27/Enterprise Deployment 2015-04-27

Code:

    public void onModuleLoad() {
               
        RootPanel.get("body_block").add(testing());
    }
    public ListGrid testing()
 {
                final ListGrid grid = new ListGrid();
                grid.setWidth(750);
                grid.setHeight(500);
                grid.setEditorCustomizer(new ListGridEditorCustomizer() {
                        public FormItem getEditor(ListGridEditorContext context) {
                                // ListGridField field = context.getEditField();
                                ListGridRecord record = (ListGridRecord) context
                                                .getEditedRecord();

                                int row = grid.getRowNum(record);
                                SC.logWarn("Got row: " + row);
                                switch (row) {
                                case 0:
                                        SpinnerItem spinnerItem = new SpinnerItem();
                                        return spinnerItem;
                                case 1:
                                        DateItem di = new DateItem();
                                        // di.setUseTextField(true);
                                        di.setDateFormatter(DateDisplayFormat.TOUSSHORTDATE);
                                        //di.setFormat("MM/DD/YYYY");
                                        return di;
                                default:
                                        return context.getDefaultProperties();
                                }
                        }
                });

                grid.setCanEdit(true);
                grid.setEditEvent(ListGridEditEvent.CLICK);
                grid.setEditByCell(true);
               
                ListGridField[] dsf = new ListGridField[3];
               
                int i = 0;
                dsf[i] = new ListGridField("C1");
                dsf[i].setWidth(100);
                dsf[i].setType(ListGridFieldType.TEXT);
                dsf[i].setTitle(null);
                dsf[i].setShowTitle(false);
                i++;
               
                dsf[i] = new ListGridField("C2");
                dsf[i].setWidth(100);
                dsf[i].setType(ListGridFieldType.TEXT);
                i++;

                dsf[i] = new ListGridField("C3");
                dsf[i].setWidth(100);
                dsf[i].setType(ListGridFieldType.TEXT);
                i++;

                grid.setFields(dsf);

                Record[] rr = new Record[4];
                Record r;
               
                r = new Record();
                r.setAttribute("C1", "Version");
                rr[0] = r;
                r = new Record();
                r.setAttribute("C1", "Effective");
                r.setAttribute("C2", "1/2/2016");
                rr[1] = r;
                r = new Record();
                r.setAttribute("C1", "ARB11");
                r.setAttribute("C2", "2");
                rr[2] = r;
                r = new Record();
                r.setAttribute("C1", "ARB12");
                r.setAttribute("C3", "2");
                rr[3] = r;
                grid.setData(rr);

                return grid;
        }

Viewing all 4756 articles
Browse latest View live