Announcement

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

    Adding any widgets to List Grid cells example

    Hello,

    I can not found any Java Script example code how to add any widgets like buttons to grid cells mentioned here:

    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.
    http://blog.isomorphic.com/?p=145

    Could you please provide me such an example?

    Regards Thomas

    #2
    If you search the documentation for "recordComponent", you should find plenty of information and an example also exists in recent nightlies - briefly, though, you need to add this code to a ListGrid:

    Code:
    showRecordComponents: true,
    showRecordComponentsByCell: true,
    
    createRecordComponent : function (record, colNum) {
        // return any canvas.
        // if you want to show components only for certain fields, you can use something like the following code
        var fieldName = this.getFieldName(colNum);
        if (fieldName == "someField") {
            return [a canvas];
        } else if (fieldName == "anotherField") {
            return [a different canvas];
        }
    
    }

    Comment


      #3
      I searched on google for adding widgets as listgrid records and landed on this page from 2006. Great! it worked for me. however, i also want to span one widget across multiple columns. how do i do that? Although this question is in the smartclient framework, i am using smartgwt and i was able to apply the solution below to smartgwt.

      Thanks and looking forward to a response.

      Originally posted by Isomorphic
      If you search the documentation for "recordComponent", you should find plenty of information and an example also exists in recent nightlies - briefly, though, you need to add this code to a ListGrid:

      Code:
      showRecordComponents: true,
      showRecordComponentsByCell: true,
      
      createRecordComponent : function (record, colNum) {
          // return any canvas.
          // if you want to show components only for certain fields, you can use something like the following code
          var fieldName = this.getFieldName(colNum);
          if (fieldName == "someField") {
              return [a canvas];
          } else if (fieldName == "anotherField") {
              return [a different canvas];
          }
      
      }

      Comment


        #4
        This feature didn't exist until 2009. Perhaps you were reading the web page of a psychic ;)

        Can you give us an idea of what you're trying to accomplish, from the end user's perspective? It's strange to want to span a component across multiple columns, and suggests that you may want to use an approach other than recordComponents.

        Comment

        Working...
        X