Announcement

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

    problem with getselectedRecord() in selectitem..possibly a bug

    Hi,

    When I attached selectitem to the listgrid then the selectitem.getselectedrecord() is giving error, but when I added the same selectitem to the dynamic form then it is working fine..Please let me know How can I solve this...The Error I am getting is


    Uncaught JavaScript exception [com.google.gwt.core.client.JavaScriptException: (TypeError): Object doesn't support this property or method
    number: -2146827850
    description: Object doesn't support this property or method
    at com.smartgwt.client.widgets.form.fields.SelectItem.getSelectedRecord(Native Method)
    at com.sikorsky.fmoc.client.composer.grid.AircraftHoursGrid$1.onChange(AircraftHoursGrid.java:209)
    at com.smartgwt.client.widgets.form.fields.events.ChangeEvent.dispatch(ChangeEvent.java:96)
    at com.smartgwt.client.widgets.form.fields.events.ChangeEvent.dispatch(ChangeEvent.java:1)
    at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65)
    at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53)
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178)
    at com.smartgwt.client.core.DataClass.fireEvent(DataClass.java:189)] in http://localhost:8080/fmoc/composer/hosted.html?composer, line 8.

    I've been struggling for almost 4 days to figure it out. Please let me know how can I solve it.

    Thanks

    #2
    By attach do you mean as an editor? What is the need for getSelectedRecord() when you can grab the edited value instead.

    Comment


      #3
      Hi,
      Thanks very much for your reply. Yes Attach in the sense add selectitem as an editor to the Listgrid.
      I will explain my problem here..
      I am creating a selectitem like this

      Below is the code that I used to create a selectitem
      SelectItem s = new SelectItem();
      DataSource locationDS = LocationGwtRpcDataSource.getInstance();

      ListGridField type = new ListGridField("locationType");
      type.setWidth(50);
      ListGridField location = new ListGridField("name");
      s.setWidth(200);
      s.setOptionDataSource(locationDS);
      s.setValueField("id");
      s.s.setDisplayField("name");
      s.setPickListWidth(350);
      s.setPickListFields(type, location);



      final ListGridField location = new ListGridField("locationName");
      location.setEditorType(s);
      location.setWidth(s.getWidth());
      location.setCanEdit(true);


      I am doing mass update in my grid. My problem here is when I edit a record and select someitem from selectlist and come to second record, then the value field (i,e., id) shows up in the grid but not the display field(i,e name).

      for ex i have a data in my grid like this

      Location
      1.NewYork
      2.Connecticut

      (grid has 2 records..Newyork is one record and Connecticut is another record) When I double click on newyork it opens a drop-down to select the desired value..when I change the value from newyork to another (for eg:Texas)..and come to the second record the the grid shows like this..

      Location
      1.1234
      2.Connecticut

      Even after changing data, I want to show name but not id .. Please let me know how can I do this..I've been struggling for almost 4 days to solve this. Please let me know if the explanation is not clear.

      Thanks in advance for any help.

      Thanks

      Comment


        #4
        Instead of creating a SelectItem have you tried instead to use the ListGridField, setting the optiondatasource for the field. It will derive the value map automatically and then just call getEditValue()

        Also may use this hack, http://forums.smartclient.com/showpo...7&postcount=12
        Last edited by svjard; 7 Jul 2010, 20:22.

        Comment


          #5
          Hi svjard,
          Thanks very much for your reply. I need to have a dropdown to select the item in the listgridfield.
          " instead to use the ListGridField, setting the optiondatasource for the field. It will derive the value map automatically and then just call getEditValue()". Can you please explain more on this or can you please post some sample code for this.

          Please help me in solving this..I am trying very bad to solve this.

          Thanks.

          Comment


            #6
            Hi Svjard,
            I found the solution..I did the same way as you told..Thanks very much for your suggestion.

            Thanks

            Comment

            Working...
            X