Announcement

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

    how extract data with onRecordClick

    hello guys

    i have a problem

    i have this code

    Code:
     
       final PartsListGrid list = new PartsListGrid();
                      list .setEmptyMessage("No Records");
                     list .setCanDragRecordsOut(true);
                     list .setCanReorderFields(true);
                     list .setDragDataAction(DragDataAction.MOVE);
                     list .setData(data);
    
     list .addRecordClickHandler(new RecordClickHandler() {
                     public void onRecordClick(RecordClickEvent event) {
    
                    
                      }
                     });
    i must convert the selected record into a string how can i do?

    if i use String s = event.getRecord()..toString(); not run

    HOW CAN I DO?

    thx very much
    Last edited by jbrown; 28 Oct 2010, 06:56.

    #2
    What is this PartsListGrid? As per my knowledge it's not a component of SmartGWT.

    Comment


      #3
      sorry i forgot

      you can find here

      http://code.google.com/p/smartgwt/so...id.java?r=1067

      i put the code

      Code:
       
      public class PartsListGrid extends ListGrid {
      
         public PartsListGrid() {
              setWidth(150);
              setCellHeight(24);
              setImageSize(16);
              setShowEdges(true);
              setBorder("0px");
              setBodyStyleName("normal");
              setShowHeader(false);
              setLeaveScrollbarGap(false);
              setEmptyMessage("<br><br>Drag &amp; drop parts here");
      
              ListGridField partSrcField = new ListGridField("partSrc", 24);
              partSrcField.setType(ListGridFieldType.IMAGE);
              partSrcField.setImgDir("pieces/16/");
      
              ListGridField partNameField = new ListGridField("partName");
              ListGridField partNumField = new ListGridField("partNum", 20);
      
              setFields(partSrcField, partNameField, partNumField);
      
              setTrackerImage(new ImgProperties("pieces/24/cubes_all.png", 24, 24));
          }
      }

      Comment


        #4
        event.getRecord() returns a record so you need to pull a field from it like event.getRecord().getAttribute("partNum").

        Comment


          #5
          Let me know how do you set data into grid.

          Comment


            #6
            Originally posted by RAS
            Let me know how do you set data into grid.

            Code:
            Record[] data = PartData.getInstance().getRec();
            Last edited by jbrown; 28 Oct 2010, 06:55.

            Comment


              #7
              THX

              String s=event.getRecord().getAttribute("partName");

              it run

              thx very very much

              Comment

              Working...
              X