Announcement

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

    Assign Value of a ListGrid Cell to a TextItem during onRecordClick Event of the Grid

    I am getting the error "Uncaught JavaScript exception [error has no properties] in http://localhost:8888/com.xxx.Campaign/sc/client/debug/debug.js, line 281" while the execution is at CampaignContent Message = (CampaignContent) event.getRecord();

    I am new to GWT/SmartGWT, can anyone pls help me overcome this error?

    I have 2 ListGrids. One of it is bound to a DataSource. I need to drag a row from the data bound grid and drop it to the second grid. When a Row in the second grid is selected I need to fill a TextItem text box in a Tab control with the value of a particular Cell of the selected Row.

    advertisementGrid.addRecordClickHandler(new RecordClickHandler(){
    public void onRecordClick(RecordClickEvent event) {
    CampaignContent Message = (CampaignContent) event.getRecord();
    codeTextItem.setValue(Message.getCampaignMessage());
    }
    });

    I am using SmartGWT 1.0b2, GWT 1.5.3 for Linux, Ubuntu 8.10, JDK 1.5.0_17, Eclipse 3.4.1
    Code taken from respective examples in Showcase (Nesting Layout, Pattern-Reuse of Grid Form binding, Drag Copy from Grids)

    The following is the code

    package com.xxx.client;

    public class Campaign implements EntryPoint {

    //Entry point method.

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

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

    HLayout mainLayout = new HLayout();
    mainLayout.setLayoutMargin(15);
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");

    Label navigationLabel = new Label();
    navigationLabel.setContents("Navigation");
    navigationLabel.setAlign(Alignment.CENTER);
    navigationLabel.setOverflow(Overflow.HIDDEN);
    navigationLabel.setWidth("30%");
    navigationLabel.setShowResizeBar(true);
    navigationLabel.setBorder("1px solid blue");

    final TreeGrid campaignTree = new TreeGrid();
    campaignTree.setLoadDataOnDemand(false);
    campaignTree.setWidth("30%");
    campaignTree.setHeight("100%");
    campaignTree.setDataSource(CampaignXmlDS.getInstance());
    campaignTree.setAutoFetchData(true);
    campaignTree.setShowConnectors(true);
    campaignTree.setNodeIcon("icons/16/folder_document.png");
    campaignTree.setFolderIcon("icons/16/folder_out.png");
    campaignTree.setShowOpenIcons(false);
    campaignTree.setShowDropIcons(false);
    campaignTree.setClosedIconSuffix("");
    campaignTree.setBaseStyle("noBorderCell");
    campaignTree.setShowResizeBar(true);
    campaignTree.setFields(new TreeGridField("Campaign"));
    campaignTree.addDataArrivedHandler(new DataArrivedHandler() {
    public void onDataArrived(DataArrivedEvent event) {
    campaignTree.getData();
    }
    });
    mainLayout.addMember(campaignTree);
    VLayout vLayout = new VLayout();
    vLayout.setWidth("70%");
    HLayout topHLayout = new HLayout();
    topHLayout.setWidth("70%");
    topHLayout.setHeight("10%");

    Label codeLabel = new Label();
    codeLabel.setContents("Campaign Code: ");
    codeLabel.setAlign(Alignment.LEFT);
    topHLayout.addMember(codeLabel);

    Label startDateLabel = new Label();
    startDateLabel.setContents("Start Date: ");
    startDateLabel.setAlign(Alignment.CENTER);
    topHLayout.addMember(startDateLabel);

    Label endDateLabel = new Label();
    endDateLabel.setContents("End Date: ");
    endDateLabel.setAlign(Alignment.RIGHT);
    topHLayout.addMember(endDateLabel);

    final DataSource campaignContentDS = CampaignContentXmlDS.getInstance();
    final CompoundEditor cEditor = new CompoundEditor(campaignContentDS);

    cEditor.setHeight("40%");
    cEditor.setShowResizeBar(true);

    HLayout advertisementHLayout = new HLayout();
    advertisementHLayout.setWidth("100%");
    advertisementHLayout.setHeight("70%");
    advertisementHLayout.setMembersMargin(5);
    advertisementHLayout.setShowResizeBar(true);

    final ListGrid advertisementGrid = new ListGrid();


    ListGridField campaigncontentcodeField =new ListGridField("campaigncontentcode","Code",50);
    ListGridField messageField =new ListGridField("message","Message",200);
    ListGridField channelField =new ListGridField("channel","Channel",75);
    advertisementGrid.setWidth("60%");
    advertisementGrid.setHeight("100%");
    advertisementGrid.setAlternateRecordStyles(true);
    advertisementGrid.setShowAllRecords(true);
    advertisementGrid.setEmptyMessage("Drop Rows Here");
    advertisementGrid.setCanReorderFields(true);
    advertisementGrid.setCanDragRecordsOut(true);
    advertisementGrid.setCanAcceptDroppedRecords(true);
    advertisementGrid.setFields(new ListGridField[]{campaigncontentcodeField, messageField, channelField});

    final TabSet advScheduleTabSet = new TabSet();
    advScheduleTabSet.setTabBarPosition(Side.TOP);
    advScheduleTabSet.setTabBarAlign(Side.LEFT);
    advScheduleTabSet.setWidth("40%");
    advScheduleTabSet.setHeight("100%");

    Tab tTab1 = new Tab("Schedule");

    final DynamicForm advScheduleForm = new DynamicForm();
    advScheduleForm.setAlign(Alignment.LEFT);

    TextItem advScheduleTextItem = new TextItem("Name");
    advScheduleTextItem.setTitleAlign(Alignment.LEFT);

    final TextItem codeTextItem = new TextItem("Code");
    codeTextItem.setTitleAlign(Alignment.LEFT);

    final TextItem campaigncontentcode = new TextItem("Test");
    advScheduleForm.setFields(advScheduleTextItem,codeTextItem,campaigncontentcode);

    tTab1.setPane(advScheduleForm);

    advScheduleTabSet.addTab(tTab1);
    advertisementHLayout.addMember(advertisementGrid);
    advertisementHLayout.addMember(advScheduleTabSet);

    advertisementGrid.addRecordClickHandler(new RecordClickHandler(){
    public void onRecordClick(RecordClickEvent event) {
    CampaignContent Message = (CampaignContent) event.getRecord();
    codeTextItem.setValue(Message.getCampaignMessage());

    }
    });

    vLayout.addMember(topHLayout);
    vLayout.addMember(cEditor);
    vLayout.addMember(advertisementHLayout);

    mainLayout.addMember(vLayout);
    mainLayout.draw();

    }

    private static class CompoundEditor extends HLayout {
    private DataSource datasource;
    private DynamicForm form;
    private ListGrid grid;
    private IButton saveButton;

    private CompoundEditor(DataSource datasource) {
    this.datasource = datasource;

    }

    protected void onInit() {
    super.onInit();
    this.form = new DynamicForm();

    TextItem campaigncontentcode = new TextItem("campaigncontentcode");
    TextItem message = new TextItem("message");
    TextItem source = new TextItem("source");

    form.setDataSource(datasource);
    form.setUseAllDataSourceFields(false);
    form.setFields(campaigncontentcode,message,source);
    saveButton = new IButton("Save");
    saveButton.setLayoutAlign(Alignment.CENTER);
    saveButton.addClickHandler(new ClickHandler() {
    public void onClick(ClickEvent event) {
    form.saveData();
    }
    });

    VLayout editorLayout = new VLayout(5);
    editorLayout.addMember(form);
    editorLayout.addMember(saveButton);
    editorLayout.setWidth(280);
    grid = new ListGrid();
    grid.setWidth(400);
    grid.setHeight("100%");
    grid.setDataSource(datasource);
    grid.setAutoFetchData(true);

    //------- For Grid D & D -------

    grid.setShowAllRecords(true);
    grid.setCanReorderRecords(true);
    grid.setCanDragRecordsOut(true);
    grid.setCanAcceptDroppedRecords(true);
    grid.setDragDataAction(DragDataAction.COPY);

    //--------------
    grid.addRecordClickHandler(new RecordClickHandler() {
    public void onRecordClick(RecordClickEvent event) {
    form.clearErrors(true);
    form.editRecord(event.getRecord());
    saveButton.enable();

    }
    });


    addMember(grid);
    addMember(editorLayout);
    }

    public DataSource getDatasource() {
    return datasource;
    }

    public void setDatasource(DataSource datasource) {
    this.datasource = datasource;
    grid.setDataSource(null);
    form.setDataSource(null);
    saveButton.disable();
    grid.fetchData();
    }
    }

    }
    ---------------------------------------------------------------------------------------------------------
    package com.xxx.client;
    public class CampaignContent extends ListGridRecord {

    public CampaignContent() {
    }
    public CampaignContent(String campaigncontentcode, String message, String channel) {
    setCampaignCode(campaigncontentcode);
    setCampaignMessage(message);
    setCampaignChannel(channel);

    }


    public void setCampaignCode(String campaignCode) {
    setAttribute("campaignCode", campaignCode);
    }

    public String getCampaignCode() {
    return getAttributeAsString("campaignCode");
    }

    public void setCampaignMessage(String campaignMessage) {
    setAttribute("campaignMessage", campaignMessage);
    }

    public String getCampaignMessage() {
    return getAttributeAsString("campaignMessage");
    }

    public void setCampaignChannel(String campaignChannel) {
    setAttribute("campaignChannel", campaignChannel);
    }

    public String getCampaignChannel() {
    return getAttributeAsString("campaignChannel");
    }

    }

    #2
    Do you get this in a real browser?

    If so, can you post a stack trace? Firebug will give you one, or the Developer Console if you run in IE.

    Comment


      #3
      No error in a Real Browser, but it is not working.

      When I Compile/Browse from GWT console, it opens a new Firefox browser. There is no error in the browser status bar when the grid row is selected. The intended functionality is not working.

      The Firebug console does not show any stack trace errors either. (Show Stack Trace With Errors option is enabled in Firebug, am I missing something here in Firebug wrt Stack trace?)

      Is there any means by which I can debug this issue with SmartClient Developer Console / Firebug?

      Comment


        #4
        Getting the following errors in Firebug

        After enabling the option "Show CSS Errors" in Firebug the following errors are shown from a real browser. (using firefox 3.0.3). Having the statement <inherits name="com.smartgwt.SmartGwtDebug"/> in *.gwt.xml file


        Code:
        Unknown property 'text-overflow'.  Declaration dropped. http://localhost:8888/com.xxx.Campaign/sc/skins/Enterprise/skin_styles.css Line 1075
        
        Unknown property 'text-overflow'. Declaration dropped. skin_styles.css (line 1168) 
        Error in parsing value for property 'filter'. Declaration dropped. skin_styles.css (line 1231)
        Error in parsing value for property 'filter'. Declaration dropped. skin_styles.css (line 1236)
        Unknown property 'text-overflow'. Declaration dropped. skin_styles.css (line 1387)
        Unknown property 'text-overflow'. Declaration dropped.skin_styles.css (line 1394)
        Unknown property 'text-overflow'. Declaration dropped.skin_styles.css (line 1401)
        Error in parsing value for property 'filter'. Declaration dropped. skin_styles.css (line 1716)
        Error in parsing value for property 'filter'. Declaration dropped. skin_styles.css (line 1720)
        Error in parsing value for property 'filter'. Declaration dropped. skin_styles.css (line 1724)
        
        Unknown property 'zoom'.  Declaration dropped. http://localhost:8888/com.xxx.Campaign/gwt/standard/standard.css Line 46
        Error in parsing value for property 'cursor'. Declaration dropped. standard.css (line 55)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 95)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 113)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 120)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 128)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 136)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 156)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 165)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 169)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 173)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 178)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 183)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 200)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 205)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 212)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 220)
        Error in parsing value for property 'cursor'. Declaration dropped. standard.css (line 235)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 353)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 362)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 367)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 372)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 377)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 382)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 401)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 409)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 416)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 424)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 453)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 462)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 467)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 472)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 477)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 482)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 501)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 509)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 516)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 524)
        Error in parsing value for property 'cursor'. Declaration dropped. standard.css (line 545)
        Error in parsing value for property 'cursor'. Declaration dropped. standard.css (line 551)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 557)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 558)
        Error in parsing value for property 'cursor'. Declaration dropped. standard.css (line 568)
        Error in parsing value for property 'cursor'. Declaration dropped. standard.css (line 574)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 580)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 581)
        Error in parsing value for property 'cursor'. Declaration dropped. standard.css (line 656)
        Error in parsing value for property 'cursor'. Declaration dropped. standard.css (line 682)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 688)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 710)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 720)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 789)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 798)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 803)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 808)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 813)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 818)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 837)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 845)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 852)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 860)
        Error in parsing value for property 'cursor'. Declaration dropped. standard.css (line 874)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 912)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 930)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 938)
        Error in parsing value for property 'cursor'. Declaration dropped. standard.css (line 954)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 974)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 982)
        Error in parsing value for property 'cursor'. Declaration dropped. standard.css (line 1025)
        Error in parsing value for property 'cursor'. Declaration dropped. standard.css (line 1031)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 1037)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 1038)
        Error in parsing value for property 'cursor'. Declaration dropped. standard.css (line 1049)
        Error in parsing value for property 'cursor'. Declaration dropped. standard.css (line 1056)
        Unknown property 'zoom'. Declaration dropped. standard.css (line 1063)
        Error in parsing value for property 'filter'. Declaration dropped. standard.css (line 1064)
        Error in parsing value for property 'cursor'. Declaration dropped. standard.css (line 1071)

        Comment


          #5
          Still not able to overcome the issue

          Any help..
          Thanks

          Comment

          Working...
          X