Announcement

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

    how to add button to cell of ListGrid in 8.0Beta?

    1.where is samples ? I can't find out any samples about following description.
    How to do ?

    Widgets in grid cells: attach any component to any Grid cell. Includes automatic lifecycle management of components for load-on-demand grids, including a component pooling mode. Works for trees too.

    2.How to add checkbox to title of ListGrid

    #2
    Here is some help for question 1, you should check the docs in your downloaded version (or maybe the smartclient 8.0 docs are online somewhere, I don't know). In the downloaded version you can find the reference docs here:
    smartclientSDK/isomorphic/system/reference/SmartClient_Reference.html

    Check the ListGrid implementation and then specifically these methods/properties:
    showRecordComponents (the docs for this property give all the info you need)
    createRecordComponent
    updateRecordComponent
    poolComponentsPerColumn

    Here is an example of code I have (editIconButtonProperties contains the common properties for an edit icon I show in the column):
    Code:
          recordComponentPoolingMode : 'recycle',
          showRecordComponentsByCell : true,
          recordComponentPosition : 'within',
          poolComponentsPerColumn : true,
          showRecordComponents : true,
          createRecordComponent : function(record, colNum) {
            var btn = null;
            var fieldName = this.getFieldName(colNum);
            if (fieldName === 'editIcon') {
              btn = isc.ImgButton.create(this.editIconButtonProperties);
              btn.viewGrid = this;
              btn.record = record;
            }
            return btn;
          },
          updateRecordComponent : function(record, colNum, component, recordChanged) {
            var fieldName = this.getFieldName(colNum);
            if (fieldName === 'editIcon') {
              component.record = record;
              return component;
            }
            return null;
          },
    btw, it really helps to also check out the source code of smartclient. The docs are great and very detailed but the code ofcourse gives even more info. I have included the source code inside Eclipse so I can easily search it.

    gr. Martin

    Comment


      #3
      Thank you very much.

      Can i add tow buttons to cell ? In my App,every cell of last column have 2 images.One is Edit,the other is Delete.


      Originally posted by martintaal
      Here is some help for question 1, you should check the docs in your downloaded version (or maybe the smartclient 8.0 docs are online somewhere, I don't know). In the downloaded version you can find the reference docs here:
      smartclientSDK/isomorphic/system/reference/SmartClient_Reference.html

      Check the ListGrid implementation and then specifically these methods/properties:
      showRecordComponents (the docs for this property give all the info you need)
      createRecordComponent
      updateRecordComponent
      poolComponentsPerColumn

      Here is an example of code I have (editIconButtonProperties contains the common properties for an edit icon I show in the column):
      Code:
            recordComponentPoolingMode : 'recycle',
            showRecordComponentsByCell : true,
            recordComponentPosition : 'within',
            poolComponentsPerColumn : true,
            showRecordComponents : true,
            createRecordComponent : function(record, colNum) {
              var btn = null;
              var fieldName = this.getFieldName(colNum);
              if (fieldName === 'editIcon') {
                btn = isc.ImgButton.create(this.editIconButtonProperties);
                btn.viewGrid = this;
                btn.record = record;
              }
              return btn;
            },
            updateRecordComponent : function(record, colNum, component, recordChanged) {
              var fieldName = this.getFieldName(colNum);
              if (fieldName === 'editIcon') {
                component.record = record;
                return component;
              }
              return null;
            },
      btw, it really helps to also check out the source code of smartclient. The docs are great and very detailed but the code ofcourse gives even more info. I have included the source code inside Eclipse so I can easily search it.

      gr. Martin

      Comment


        #4
        The record component is a Canvas so you can create a Layout with 2 buttons and use that Layout as the recordComponent.

        gr. Martin

        Comment


          #5
          Thank you again.


          1.component overflow when column's width less than component's width. And make this compoent's VAlign is center in the cell automaticly ?

          2.how to add Checkbox component to title of column "xxx" ?

          Don't use http://localhost:8080/isomorphic/sys...heckbox.Select .


          Image is here :
          http://xmlspy.javaeye.com/blog/785045



          Originally posted by martintaal
          The record component is a Canvas so you can create a Layout with 2 buttons and use that Layout as the recordComponent.

          gr. Martin
          Last edited by xmlspy; 14 Oct 2010, 01:24.

          Comment


            #6
            also can use ToolStrip to add members that include 2 buttons.


            Originally posted by martintaal
            The record component is a Canvas so you can create a Layout with 2 buttons and use that Layout as the recordComponent.

            gr. Martin

            Comment

            Working...
            X