Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    SmartGWT Checkbox tree cascade select and partial select not working

    Hi,

    i am using GWT 1.6.4 and added smartGWT.jar in the project. Application uses both GWT-EXT and Smart GWT. I want to use smartGWT checkbox tree in my app.

    I refered
    http://www.smartclient.com/smartgwt/showcase/#tree_checkbox
    this link. But in my case checkboxes are displayed just as a column and not aligned to nodes as displayed in the eg. Also when I select the child node the cascaded parents are not getting checked.

    I have used
    gplTreeGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
    gplTreeGrid.setShowPartialSelection(true);
    gplTreeGrid.setCascadeSelection(true);

    Any ideas?

    Regards,
    Sanket

    #2
    Sounds like you are using an old version of SmartGWT. Please provide all version details as noted in the new thread template.

    Comment


      #3
      I am using smartGWT 2.1 & I am using IE8

      Attaching the screen shot for your reference.

      Please let me know if u need any other details

      Thanks!

      Regards,
      Sanket
      Attached Files

      Comment


        #4
        Any help on this is much appreciated!! Any updates on the above issue?


        Regards,
        Sanket

        Comment


          #5
          Be sure your post includes:

          1. the SmartGWT or SmartClient version and browser version(s) involved;
          smartGWT2.1 and using IE8

          2. for a server-side problem, the complete logs generated during processing of the request;

          3. for a client-side problem, the contents of the Developer Console (see FAQ for usage);

          Facing a UI Issue not gettting the display proper

          4. if there is a JavaScript error, the stack trace logged in the Developer Console (from Internet Explorer if possible); and

          5. sample code.

          package com.jpmc.creditMurex.web.client.panamaNrdb.security;

          import com.google.gwt.core.client.GWT;
          import com.google.gwt.user.client.rpc.AsyncCallback;
          import com.gwtext.client.core.EventObject;
          import com.gwtext.client.data.FieldDef;
          import com.gwtext.client.data.JsonReader;
          import com.gwtext.client.data.Reader;
          import com.gwtext.client.data.Record;
          import com.gwtext.client.data.RecordDef;
          import com.gwtext.client.data.Store;
          import com.gwtext.client.data.StringFieldDef;
          import com.gwtext.client.data.event.StoreListenerAdapter;
          import com.gwtext.client.widgets.Button;
          import com.gwtext.client.widgets.MessageBox;
          import com.gwtext.client.widgets.Panel;
          import com.gwtext.client.widgets.Window;
          import com.gwtext.client.widgets.event.ButtonListenerAdapter;
          import com.gwtext.client.widgets.event.PanelListener;
          import com.gwtext.client.widgets.event.PanelListenerAdapter;
          import com.gwtext.client.widgets.form.FieldSet;
          import com.gwtext.client.widgets.form.TextField;
          import com.gwtext.client.widgets.grid.BaseColumnConfig;
          import com.gwtext.client.widgets.grid.CheckboxColumnConfig;
          import com.gwtext.client.widgets.grid.CheckboxSelectionModel;
          import com.gwtext.client.widgets.grid.ColumnConfig;
          import com.gwtext.client.widgets.grid.ColumnModel;
          import com.gwtext.client.widgets.grid.GridPanel;
          import com.gwtext.client.widgets.layout.HorizontalLayout;
          import com.gwtext.client.widgets.tree.TreePanel;
          import com.jpmc.creditMurex.web.client.Web;
          import com.jpmc.creditMurex.web.client.services.DatabaseService;
          import com.jpmc.creditMurex.web.client.services.DatabaseServiceAsync;
          import com.smartgwt.client.types.SelectionAppearance;
          import com.smartgwt.client.types.SelectionType;
          import com.smartgwt.client.types.TreeModelType;
          import com.smartgwt.client.widgets.events.DrawEvent;
          import com.smartgwt.client.widgets.events.DrawHandler;
          import com.smartgwt.client.widgets.form.DynamicForm;
          import com.smartgwt.client.widgets.form.fields.CheckboxItem;
          import com.smartgwt.client.widgets.form.fields.events.ChangeEvent;
          import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
          import com.smartgwt.client.widgets.layout.HLayout;
          import com.smartgwt.client.widgets.tree.Tree;
          import com.smartgwt.client.widgets.tree.TreeGrid;
          import com.smartgwt.client.widgets.tree.TreeNode;

          public class RoleEditor {

          private static FieldSet fieldSetRoleDetails = null;
          private static FieldSet fieldSetParent = null;
          private static FieldSet fieldSetGPL = null;
          private static FieldSet fieldSetUser = null;
          private static FieldSet fieldSetAction = null;
          private static FieldSet fieldSetButton = null;
          private static TextField txtName = null;
          private static TextField txtDescription = null;
          private static Button cancel = null;
          private static Button save = null;
          static Store userDataStore = null;
          static RecordDef userDataRecordDef= null;
          static JsonReader userDataReader = null;
          static GridPanel userDataGrid = null;
          static ColumnModel userColumnModel = null;
          static CheckboxSelectionModel cbSelectionModelUser = null;
          static String gplHierarchyData = null;
          static String userData = null;
          static String actionData = null;
          static Store actionDataStore = null;
          static RecordDef actionDataRecordDef= null;
          static JsonReader actionDataReader = null;
          static Store roleUserStore = null;
          static RecordDef roleUserRecordDef= null;
          static JsonReader roleUserReader = null;
          static Store roleActionStore = null;
          static RecordDef roleActionRecordDef= null;
          static JsonReader roleActionReader = null;
          static Store roleGPLStore = null;
          static RecordDef roleGPLRecordDef= null;
          static JsonReader roleGPLReader = null;
          static GridPanel actionDataGrid = null;
          static ColumnModel actionDataColumnModel = null;
          static CheckboxSelectionModel cbSelectionModelAction = null;
          static Store gplStore = null;
          static RecordDef gplRecordDef= null;
          static JsonReader gplReader = null;
          static GridPanel gplGrid = null;
          ColumnModel gplColumnModel = null;
          static TreeNode[] gplData = null;
          static TreeGrid gplTreeGrid = null;
          static DynamicForm dynaForm = null;
          static Tree gplTree = null;
          static Panel panel = null;
          private static String idRole = null;
          private static String role = null;
          private static String desc = null;
          private static Record [] actionIdsRecord = null;
          private static Record [] userIdsRecord = null;
          private static Record [] roleUserRecords = null;
          private static Record [] roleActionRecords = null;
          private static Record [] roleGPLRecords = null;
          private static String actionIDs = "";
          private static String userIDs = "";
          private static DatabaseServiceAsync databaseSerivce = (DatabaseServiceAsync) GWT.create(DatabaseService.class);

          public RoleEditor(){

          }
          public static Panel getPanel(String roleId, String roleName, String roleDesc, boolean flag,final Window window) {
          panel = new Panel();
          panel.setBorder(false);

          /* Panel inner = new Panel();
          inner.setLayout(new ColumnLayout());

          Panel columnOne = new Panel();
          columnOne.setLayout(new FitLayout());

          Panel inner1 = new Panel();
          inner1.setLayout(new ColumnLayout());*/

          fieldSetRoleDetails = new FieldSet();
          fieldSetRoleDetails.setTitle("Role Details");
          fieldSetRoleDetails.setLabelWidth(90);
          fieldSetRoleDetails.setHeight(100);
          fieldSetRoleDetails.setWidth(980);

          fieldSetParent = new FieldSet();
          fieldSetParent.setTitle("");
          fieldSetParent.setLayout(new HorizontalLayout(10));
          fieldSetParent.setWidth(980);

          fieldSetGPL = new FieldSet();
          fieldSetGPL.setTitle("GPL Hierarchy");
          fieldSetGPL.setWidth(450);
          fieldSetGPL.setHeight(300);

          fieldSetUser = new FieldSet();
          fieldSetUser.setTitle("Users");
          fieldSetUser.setWidth(450);
          fieldSetUser.setHeight(300);

          fieldSetAction = new FieldSet();
          fieldSetAction.setTitle("Action");
          fieldSetAction.setWidth(900);
          fieldSetAction.setHeight(200);

          fieldSetButton = new FieldSet();
          fieldSetButton.setLabelWidth(90);
          fieldSetButton.setHeight(30);
          fieldSetButton.setWidth(980);
          fieldSetButton.setAutoWidth(false);
          fieldSetButton.setAutoHeight(false);
          fieldSetButton.setLayout(new HorizontalLayout(10));

          roleUserRecordDef = new RecordDef(new FieldDef[]{
          new StringFieldDef("idUser", "idUser"),
          new StringFieldDef("name", "name"),
          new StringFieldDef("userName", "userName"),
          });
          roleUserReader = new JsonReader(roleUserRecordDef);
          roleUserStore = new Store(roleUserReader);

          roleActionRecordDef = new RecordDef(new FieldDef[]{
          new StringFieldDef("idAction", "idAction"),
          new StringFieldDef("actionEntitlement", "actionEntitlement"),
          });
          roleActionReader = new JsonReader(roleActionRecordDef);
          roleActionStore = new Store(roleActionReader);

          roleGPLRecordDef = new RecordDef(new FieldDef[]{
          new StringFieldDef("idNode", "idNode"),
          new StringFieldDef("name", "name"),
          });
          roleGPLReader = new JsonReader(roleGPLRecordDef);
          roleGPLStore = new Store(roleGPLReader);

          gplRecordDef = new RecordDef(new FieldDef[]{
          new StringFieldDef("node", "node"),
          new StringFieldDef("parentNode", "parentNode"),
          new StringFieldDef("name", "name"),
          });
          gplReader = new JsonReader(gplRecordDef);
          gplStore = new Store(gplReader);


          gplTree = new Tree();
          gplTree.setModelType(TreeModelType.PARENT);
          gplTree.setRootValue(1);
          gplTree.setNameProperty("Name");
          gplTree.setIdField("Node");
          gplTree.setParentIdField("ParentNode");
          gplTree.setOpenProperty("isOpen");
          gplTree.setData(gplData);

          gplTreeGrid = new TreeGrid();
          gplTreeGrid.setWidth(470);
          gplTreeGrid.setHeight(320);
          gplTreeGrid.setShowOpenIcons(false);
          gplTreeGrid.setShowDropIcons(false);
          gplTreeGrid.setClosedIconSuffix("");
          gplTreeGrid.setData(gplTree);
          gplTreeGrid.setShowSelectedStyle(false);
          gplTreeGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
          gplTreeGrid.setShowPartialSelection(true);
          gplTreeGrid.setCascadeSelection(true);


          gplTreeGrid.addDrawHandler(new DrawHandler() {
          public void onDraw(DrawEvent event) {
          gplTreeGrid.getTree().openAll();
          }
          });

          final CheckboxItem partialSelection = new CheckboxItem("partialSelect", "Allow Partial Selection");
          partialSelection.setDefaultValue(true);

          partialSelection.addChangeHandler(new ChangeHandler() {
          public void onChange(ChangeEvent event) {
          boolean selected = partialSelection.getValueAsBoolean();
          gplTreeGrid.setShowPartialSelection(!selected);
          gplTreeGrid.redraw();
          }
          });


          dynaForm = new DynamicForm();
          //dynaForm.addChild(gplTreeGrid);
          dynaForm.setFields(partialSelection);
          //partialSelection.setVisible(false);

          //fieldSetGPL.add(dynaForm);

          final HLayout layout = new HLayout(10);
          layout.setWidth(445);
          layout.setHeight(320);
          layout.setBorder("1px");
          layout.setTitle("GPL Hierarchy");
          layout.addMember(gplTreeGrid);
          layout.addMember(dynaForm);
          //dynaForm.setVisible(false);

          layout.draw();

          gplStore.addStoreListener(new StoreListenerAdapter(){
          public void onLoad(Store store, Record[] records) {
          gplData = new TreeNode[gplStore.getRecords().length];
          for(int i=0;i<gplData.length;i++){
          gplData[i] = new GPLTreeNode(gplStore.getRecordAt(i).getAsString("node"),
          gplStore.getRecordAt(i).getAsString("parentNode"),
          gplStore.getRecordAt(i).getAsString("name"),
          true);
          gplTree.loadChildren(gplData[i]);
          }
          }
          });

          cbSelectionModelUser = new CheckboxSelectionModel();
          ColumnConfig userIdDataConfig = new ColumnConfig("idUser","idUser");
          userIdDataConfig.setHidden(true);
          BaseColumnConfig[] userColumns = new BaseColumnConfig[]{
          new CheckboxColumnConfig(cbSelectionModelUser),
          userIdDataConfig,
          new ColumnConfig("User Name","name"),
          new ColumnConfig("SID","userName"),
          };

          userColumnModel = new ColumnModel(userColumns);

          userDataRecordDef = new RecordDef(new FieldDef[]{
          new StringFieldDef("idUser", "idUser"),
          new StringFieldDef("name","name"),
          new StringFieldDef("userName","userName"),
          });

          userDataReader = new JsonReader(userDataRecordDef);
          userDataStore = new Store(userDataReader);
          userDataGrid = new GridPanel ();
          userDataGrid.setStore(userDataStore);
          userDataGrid.setColumnModel(userColumnModel);
          userDataGrid.setFrame(true);
          userDataGrid.setStripeRows(true);
          userDataGrid.setAutoHeight(false);
          userDataGrid.setAutoWidth(false);
          userDataGrid.setHeight(300);
          userDataGrid.setWidth(470);
          userDataGrid.setAutoScroll(true);
          userDataGrid.setSelectionModel(cbSelectionModelUser);

          fieldSetUser.add(userDataGrid);

          cbSelectionModelAction = new CheckboxSelectionModel();
          ColumnConfig actionIdDataConfig = new ColumnConfig("idAction","idAction");
          actionIdDataConfig.setHidden(true);
          BaseColumnConfig[] actionDataColumns = new BaseColumnConfig[]{
          new CheckboxColumnConfig(cbSelectionModelAction),
          actionIdDataConfig,
          new ColumnConfig("Action","actionEntitlement",150),
          };

          actionDataColumnModel = new ColumnModel(actionDataColumns);

          actionDataRecordDef = new RecordDef(new FieldDef[]{
          new StringFieldDef("idAction", "idAction"),
          new StringFieldDef("actionEntitlement","actionEntitlement"),

          });
          actionDataReader = new JsonReader(actionDataRecordDef);

          actionDataStore = new Store(actionDataReader);

          actionDataGrid = new GridPanel ();
          actionDataGrid.setStore(actionDataStore);
          actionDataGrid.setColumnModel(actionDataColumnModel);
          actionDataGrid.setFrame(true);
          actionDataGrid.setStripeRows(true);
          actionDataGrid.setAutoHeight(false);
          actionDataGrid.setAutoWidth(false);
          actionDataGrid.setHeight(200);
          actionDataGrid.setWidth(960);
          actionDataGrid.setAutoScroll(true);
          actionDataGrid.setSelectionModel(cbSelectionModelAction);


          fieldSetAction.add(actionDataGrid);

          txtName = new TextField("Name","Name",290);
          txtDescription = new TextField("Description","Description",290);
          if(flag){
          txtName.setDisabled(true);
          }else{
          txtName.setDisabled(false);
          }

          txtName.setValue(roleName);
          txtDescription.setValue(roleDesc);
          idRole = roleId;

          fieldSetRoleDetails.add(txtName);
          fieldSetRoleDetails.add(txtDescription);

          cancel = new Button("Cancel", new ButtonListenerAdapter() {
          public void onClick(Button button, EventObject e) {
          window.close();
          }
          });

          save = new Button("Save", new ButtonListenerAdapter() {
          public void onClick(Button button, EventObject e) {
          AsyncCallback saveRoleCallback = new AsyncCallback() {

          public void onFailure(Throwable caught) {

          // TODO: Do something with errors.
          System.out.println("Failed to save Action");
          MessageBox.alert("Failure", caught.getMessage());
          //caught.printStackTrace();
          }



          public void onSuccess(Object result) {

          // TODO Auto-generated method stub
          System.out.println("Action Saved Successfully");
          window.close();
          NRDBSecurity.updateRole();
          }

          };


          userIdsRecord = new Record[userDataGrid.getSelectionModel().getSelections().length];
          userIdsRecord = userDataGrid.getSelectionModel().getSelections();
          System.out.println("User id record count is:" + userIdsRecord.length);
          for(int i=0; i<userIdsRecord.length;i++){
          if(i==(userIdsRecord.length - 1)){
          userIDs += userIdsRecord[i].getAsString("idUser");
          System.out.println("USerIds are:" + userIdsRecord[i].getAsString("idUser"));
          }else{
          userIDs += userIdsRecord[i].getAsString("idUser");
          System.out.println("UserIds are:" + userIdsRecord[i].getAsString("idUser"));
          userIDs +=",";

          }
          }

          actionIdsRecord = new Record[userDataGrid.getSelectionModel().getSelections().length];
          actionIdsRecord = userDataGrid.getSelectionModel().getSelections();
          System.out.println("Role id record count is:" + actionIdsRecord.length);
          for(int i=0; i<actionIdsRecord.length;i++){
          if(i==(actionIdsRecord.length - 1)){
          actionIDs += actionIdsRecord[i].getAsString("idAction");
          System.out.println("RoleIds are:" + actionIdsRecord[i].getAsString("idAction"));
          }else{
          actionIDs += actionIdsRecord[i].getAsString("idUser");
          System.out.println("RoleIds are:" + actionIdsRecord[i].getAsString("idAction"));
          actionIDs +=",";

          }
          }

          databaseSerivce.saveRole(idRole, txtName.getValueAsString(), txtDescription.getValueAsString(), new String(), actionIDs, userIDs, Web.jUserName, saveRoleCallback);

          }
          });

          fieldSetButton.add(cancel);
          fieldSetButton.add(save);

          //fieldSetGPL.add(gplTree);
          fieldSetParent.add(layout);
          fieldSetParent.add(fieldSetUser);

          panel.add(fieldSetRoleDetails);
          panel.add(fieldSetParent);
          panel.add(fieldSetAction);
          panel.add(fieldSetButton);
          initialize(idRole, flag);

          return panel;
          }

          private static void initialize(String roleId, boolean flag)
          {
          System.out.println("In initialize method for RoleEditor");
          getRoleAction(roleId);
          getRoleUser(roleId);
          getRoleGPL(roleId);
          //Populate GPL tree
          loadGPLHierarchy(flag);
          //Populate Users
          loadUsers(flag);
          //Populate Action
          loadActions(flag);
          }

          public static void loadGPLHierarchy(final boolean flag)
          {
          System.out.println("In loadGPLHierarchy method of RoleEditor");
          try{

          gplReader.setRoot("tradeData");
          gplReader.setTotalProperty("totalCount");
          //userStore = new Store(dataProxy, reader, true);

          AsyncCallback gplCallback = new AsyncCallback() {

          public void onFailure(Throwable caught) {

          // TODO: Do something with errors.
          System.out.println("Failure");
          caught.printStackTrace();
          }



          public void onSuccess(Object result) {

          // TODO Auto-generated method stub
          System.out.println("Success");
          gplHierarchyData = null;
          gplHierarchyData = result.toString();
          if(gplStore != null){
          gplStore.removeAll();
          }
          gplStore.loadJsonData(gplHierarchyData, true );
          // must commit changes to see the data
          // inside the grid!!!

          /*int index = -1;
          if(flag){
          for(int i =0; i< roleGPLRecords.length; i++){
          TreeNode gplTreeNode = gplTreeGrid.getTree().find("idNode", roleGPLRecords[i].getAsString("idNode"));
          index = gplTreeNode.getAttributeAsInt("index");
          gplTreeGrid.selectRecord(index);

          }
          }*/

          gplStore.commitChanges();
          //userGrid.setStore(userStore);
          /*gplData = new TreeNode[gplStore.getRecords().length];
          for(int i=0;i<gplData.length;i++){
          gplData[i] = new GPLTreeNode(gplStore.getRecordAt(i).getAsString("node"),
          gplStore.getRecordAt(i).getAsString("parentNode"),
          gplStore.getRecordAt(i).getAsString("name"),
          false);

          } */

          /*gplTree = new Tree();
          gplTree.setModelType(TreeModelType.PARENT);
          gplTree.setRootValue(1);
          gplTree.setNameProperty("Name");
          gplTree.setIdField("Node");
          gplTree.setParentIdField("ParentNode");
          gplTree.setOpenProperty("isOpen");
          gplTree.setData(gplData);

          gplTreeGrid = new TreeGrid();
          gplTreeGrid.setWidth(445);
          gplTreeGrid.setHeight(300);
          gplTreeGrid.setShowOpenIcons(false);
          gplTreeGrid.setShowDropIcons(false);
          gplTreeGrid.setClosedIconSuffix("");
          gplTreeGrid.setData(gplTree);
          gplTreeGrid.setShowSelectedStyle(false);
          gplTreeGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
          gplTreeGrid.setShowPartialSelection(true);
          gplTreeGrid.setCascadeSelection(true);


          gplTreeGrid.addDrawHandler(new DrawHandler() {
          public void onDraw(DrawEvent event) {
          gplTreeGrid.getTree().closeAll();
          }
          }); */

          /*CheckboxItem partialSelection = new CheckboxItem("partialSelect", "Allow Partial Selection");
          partialSelection.setDefaultValue(true);

          dynaForm = new DynamicForm();
          dynaForm.addChild(gplTreeGrid);
          dynaForm.setFields(partialSelection);
          partialSelection.setVisible(false);

          fieldSetGPL.add(dynaForm); */
          //gplTreeGrid.refreshFields();
          //panel.doLayout();

          }

          };
          databaseSerivce.getGPLHierarchy(gplCallback);

          }catch(Exception e){}
          }

          public static class GPLTreeNode extends TreeNode {
          public GPLTreeNode(String node, String parentNode, String name, boolean isOpen) {
          setAttribute("Node", node);
          setAttribute("ParentNode", parentNode);
          setAttribute("Name", name);
          setAttribute("isOpen", isOpen);
          }
          }


          private static void loadUsers(final boolean flag)
          {
          try{
          System.out.println("In loadUsers method of RoleEditor");
          userDataReader.setRoot("tradeData");
          userDataReader.setTotalProperty("totalCount");
          //userStore = new Store(dataProxy, reader, true);
          AsyncCallback userDataCallback = new AsyncCallback() {

          public void onFailure(Throwable caught) {

          // TODO: Do something with errors.
          System.out.println("Failure");
          caught.printStackTrace();
          }

          public void onSuccess(Object result) {

          // TODO Auto-generated method stub
          System.out.println("Success");
          userData = null;
          userData = result.toString();
          if(userDataStore != null){
          userDataStore.removeAll();
          }
          userDataStore.loadJsonData( userData, true );
          // must commit changes to see the data
          // inside the grid!!!
          int index = -1;
          if(flag){
          for(int i =0; i< roleUserRecords.length; i++){
          index = userDataGrid.getStore().find("idUser", roleUserRecords[i].getAsString("idUser"),0,false,true);
          cbSelectionModelUser.selectRow(index, true);
          }
          }
          userDataStore.commitChanges();
          }

          };
          databaseSerivce.getUser(null,userDataCallback);

          }catch(Exception e){}
          }

          private static void loadActions(final boolean flag)
          {
          try{

          System.out.println("In loadActions method of RoleEditor");
          actionDataReader.setRoot("tradeData");
          actionDataReader.setTotalProperty("totalCount");
          //userStore = new Store(dataProxy, reader, true);
          AsyncCallback actionDataCallback = new AsyncCallback() {

          public void onFailure(Throwable caught) {

          // TODO: Do something with errors.
          System.out.println("Failure");
          caught.printStackTrace();
          }



          public void onSuccess(Object result) {

          // TODO Auto-generated method stub
          System.out.println("Success");
          actionData = null;
          actionData = result.toString();
          if(actionDataStore != null){
          actionDataStore.removeAll();
          }
          actionDataStore.loadJsonData( actionData, true );
          // must commit changes to see the data
          // inside the grid!!!
          int index = -1;
          if(flag){
          for(int i =0; i< roleActionRecords.length; i++){
          index = actionDataGrid.getStore().find("idAction", roleActionRecords[i].getAsString("idAction"),0,false,true);
          cbSelectionModelAction.selectRow(index, true);
          }
          }
          actionDataStore.commitChanges();
          }

          };
          databaseSerivce.getAction(null, actionDataCallback);

          }catch(Exception e){}

          }

          public static synchronized void getRoleUser(String idRole) {
          try{
          System.out.println("In getRoleUser role id is:" + idRole);
          roleUserReader.setRoot("tradeData");
          roleUserReader.setTotalProperty("totalCount");

          AsyncCallback roleUserCallback = new AsyncCallback() {

          public void onFailure(Throwable caught) {

          // TODO: Do something with errors.
          System.out.println("Failure");
          //caught.printStackTrace();
          }



          public void onSuccess(Object result) {

          // TODO Auto-generated method stub
          System.out.println("Success");
          String jsonData = null;
          jsonData = result.toString();
          if(roleUserStore != null){
          roleUserStore.removeAll();
          }
          roleUserStore.loadJsonData( jsonData, true );
          // must commit changes to see the data
          // inside the grid!!!
          System.out.println("Roles for a user after fetched: " + jsonData);
          roleUserRecords = new Record[roleUserStore.getRecords().length];
          roleUserRecords = roleUserStore.getRecords();

          System.out.println("In Get User Role Store Record Length is: " + roleUserRecords.length);
          for(int i=0;i<roleUserRecords.length;i++){

          System.out.println("User ids for the role are: " + roleUserRecords[i].getAsString("idUser"));
          System.out.println("User names for the role are: " + roleUserRecords[i].getAsString("name"));
          System.out.println("User SID for the role are: " + roleUserRecords[i].getAsString("userName"));
          }

          }

          };
          databaseSerivce.getRoleUser(idRole,roleUserCallback);

          }catch(Exception e){
          e.printStackTrace();
          }
          }

          public static synchronized void getRoleAction(String idRole) {
          try{
          System.out.println("In getRoleAction role id is:" + idRole);
          roleActionReader.setRoot("tradeData");
          roleActionReader.setTotalProperty("totalCount");

          AsyncCallback roleActionCallback = new AsyncCallback() {

          public void onFailure(Throwable caught) {

          // TODO: Do something with errors.
          System.out.println("Failure");
          //caught.printStackTrace();
          }

          public void onSuccess(Object result) {

          // TODO Auto-generated method stub
          System.out.println("Success");
          String jsonData = null;
          jsonData = result.toString();
          if(roleActionStore != null){
          roleActionStore.removeAll();
          }
          roleActionStore.loadJsonData( jsonData, true );
          // must commit changes to see the data
          // inside the grid!!!
          System.out.println("Actions for a role after fetched: " + jsonData);
          roleActionRecords = new Record[roleActionStore.getRecords().length];
          roleActionRecords = roleActionStore.getRecords();

          System.out.println("In getRoleAction Store Record Length is: " + roleActionRecords.length);
          for(int i=0;i<roleActionRecords.length;i++){
          System.out.println("Action ids for the role are: " + roleActionRecords[i].getAsString("idAction"));
          System.out.println("Action names for the role are: " + roleActionRecords[i].getAsString("actionEntitlement"));
          }

          }

          };
          databaseSerivce.getRoleAction(idRole,roleActionCallback);

          }catch(Exception e){
          e.printStackTrace();
          }
          }

          public static synchronized void getRoleGPL(String idRole) {
          try{
          System.out.println("In getRoleGPL role id is:" + idRole);
          roleGPLReader.setRoot("tradeData");
          roleGPLReader.setTotalProperty("totalCount");

          AsyncCallback roleGPLCallback = new AsyncCallback() {

          public void onFailure(Throwable caught) {

          // TODO: Do something with errors.
          System.out.println("Failure");
          //caught.printStackTrace();
          }

          public void onSuccess(Object result) {

          // TODO Auto-generated method stub
          System.out.println("Success");
          String jsonData = null;
          jsonData = result.toString();
          if(roleGPLStore != null){
          roleGPLStore.removeAll();
          }
          roleGPLStore.loadJsonData( jsonData, true );
          // must commit changes to see the data
          // inside the grid!!!
          System.out.println("GPL Nodes for a role after fetched: " + jsonData);
          roleGPLRecords = new Record[roleGPLStore.getRecords().length];
          roleGPLRecords = roleGPLStore.getRecords();

          System.out.println("In getRoleGPL Store Record Length is: " + roleGPLRecords.length);
          for(int i=0;i<roleGPLRecords.length;i++){
          System.out.println("GPL Node ids for the role are: " + roleGPLRecords[i].getAsString("idNode"));
          System.out.println("GPL Node names for the role are: " + roleGPLRecords[i].getAsString("name"));
          }

          }

          };
          databaseSerivce.getRoleGPLNode(idRole,roleGPLCallback);

          }catch(Exception e){
          e.printStackTrace();
          }
          }
          }


          Posts with incomplete information are much more likely to be ignored.

          Comment


            #6
            I thought this forum is to support smartGWT issues. isn't there anyone who can at least reply that what could be the issue?


            Regards,
            Sanket

            Comment


              #7
              Your sample cannot be dropped into an SGWT sample and run standalone so it can't be tested. You need to simplify the example removing all gwtext or other library references. Would also recommend you try with a recent nightly as there have been a ton of changes since SGWT 2.1.

              Comment


                #8
                Originally posted by davidj6
                Your sample cannot be dropped into an SGWT sample and run standalone so it can't be tested. You need to simplify the example removing all gwtext or other library references. Would also recommend you try with a recent nightly as there have been a ton of changes since SGWT 2.1.
                indeed.

                1. Update GWT (at least to 2.1) & SmartGWT 2.4
                2. Post small amount of runnable code.

                Create a simple example, and see if the problem persist. Then, post this simple example, so we can better help you.

                Comment


                  #9
                  Hi Thanks for the reply. I also tried just using showcase example but i still got the same UI as attached in first thread. Just made minor change to return canvas. Please see the code:

                  import com.smartgwt.client.types.ExpansionMode;
                  import com.smartgwt.client.types.SelectionAppearance;
                  import com.smartgwt.client.types.SelectionStyle;
                  import com.smartgwt.client.types.SelectionType;
                  import com.smartgwt.client.types.TreeModelType;
                  import com.smartgwt.client.widgets.Canvas;
                  import com.smartgwt.client.widgets.Window;
                  import com.smartgwt.client.widgets.events.DrawEvent;
                  import com.smartgwt.client.widgets.events.DrawHandler;
                  import com.smartgwt.client.widgets.form.DynamicForm;
                  import com.smartgwt.client.widgets.form.fields.CheckboxItem;
                  import com.smartgwt.client.widgets.form.fields.events.ChangeEvent;
                  import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
                  import com.smartgwt.client.widgets.grid.CellFormatter;
                  import com.smartgwt.client.widgets.grid.ListGridRecord;
                  import com.smartgwt.client.widgets.layout.HLayout;
                  import com.smartgwt.client.widgets.layout.VLayout;
                  import com.smartgwt.client.widgets.tree.Tree;
                  import com.smartgwt.client.widgets.tree.TreeGrid;
                  import com.smartgwt.client.widgets.tree.TreeGridField;
                  import com.smartgwt.client.widgets.tree.TreeNode;

                  public class RoleEditor{

                  public static final TreeNode[] employeeData = new TreeNode[] {
                  new EmployeeTreeNode("4", "1", "Charles Madigen", "Chief Operating Officer", true),
                  new EmployeeTreeNode("189", "4", "Gene Porter", "Mgr Tech Plng IntIS T", false),
                  new EmployeeTreeNode("265", "189", "Olivier Doucet", "Asset Spec Lines Stns", false),
                  new EmployeeTreeNode("264", "189", "Cheryl Pearson", "Dsl Sys Rep", false),
                  new EmployeeTreeNode("188", "4", "Rogine Leger", "Mgr Syst P P", true)
                  };

                  public static Canvas getCanvas(String roleId,String roleName,String roleDesc,boolean flag,Window window) {
                  Canvas canvas = new Canvas();

                  Tree employeeTree = new Tree();
                  employeeTree.setModelType(TreeModelType.PARENT);
                  employeeTree.setRootValue(1);
                  employeeTree.setNameProperty("Name");
                  employeeTree.setIdField("EmployeeId");
                  employeeTree.setParentIdField("ReportsTo");
                  employeeTree.setOpenProperty("isOpen");
                  employeeTree.setData(employeeData);


                  final TreeGrid employeeTreeGrid = new TreeGrid();
                  employeeTreeGrid.setWidth(200);
                  employeeTreeGrid.setHeight(240);
                  employeeTreeGrid.setShowOpenIcons(false);
                  employeeTreeGrid.setShowDropIcons(false);
                  employeeTreeGrid.setClosedIconSuffix("");
                  employeeTreeGrid.setData(employeeTree);
                  employeeTreeGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
                  employeeTreeGrid.setShowSelectedStyle(true);
                  employeeTreeGrid.setShowPartialSelection(true);
                  employeeTreeGrid.setCascadeSelection(true);
                  employeeTreeGrid.setShowRecordComponents(true);
                  employeeTreeGrid.setChildExpansionMode(ExpansionMode.DETAIL_FIELD);
                  employeeTreeGrid.setShowSelectionCanvas(true);
                  employeeTreeGrid.setSelectionType(SelectionStyle.SIMPLE);


                  employeeTreeGrid.addDrawHandler(new DrawHandler() {
                  public void onDraw(DrawEvent event) {
                  employeeTreeGrid.getTree().openAll();
                  }
                  });

                  DynamicForm df = new DynamicForm();

                  final CheckboxItem partialSelection = new CheckboxItem("partialSelect", "Allow Partial Selection");
                  partialSelection.setDefaultValue(true);
                  partialSelection.addChangeHandler(new ChangeHandler() {
                  public void onChange(ChangeEvent event) {
                  boolean selected = partialSelection.getValueAsBoolean();
                  employeeTreeGrid.setShowPartialSelection(!selected);
                  employeeTreeGrid.redraw();
                  }
                  });

                  df.setFields(partialSelection);

                  HLayout layout = new HLayout(20);
                  layout.addMember(employeeTreeGrid);
                  layout.addMember(df);

                  layout.draw();
                  canvas.addChild(layout);

                  return canvas;

                  }

                  public static class EmployeeTreeNode extends TreeNode {
                  public EmployeeTreeNode(String employeeId, String reportsTo, String name, String job, boolean isOpen) {
                  setAttribute("EmployeeId", employeeId);
                  setAttribute("ReportsTo", reportsTo);
                  setAttribute("Name", name);
                  setAttribute("Job", job);
                  setAttribute("isOpen", isOpen);
                  }
                  }

                  }

                  My concern here is can we use smartGWT control in GWT-EXT UI? We also used some of them earlier but not in a single tab before. I am getting particular problem only with this control as i tried to use example on a separate tab also but still got the same result!

                  Do we get LGPL version of the GWT & smartGWT versions you have suggested because we are using LGPL version and to get licensed one will need approvals!

                  Can you please give some input on above queries?

                  Thanks & Regards,
                  Sanket Naik

                  Comment


                    #10
                    Can anyone please update on this?


                    Regards,
                    Sanket

                    Comment

                    Working...
                    X