Announcement

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

    Button in cell

    Trying to show a push button in a cell. The column does not have any underlying data. Button's purpose is to remove records.
    Here is my code:
    ListGrid:
    Code:
    getBaseStyle: function (record, rowNum, colNum) {
    if (colNum == 4) 	        
    return "groovybutton"
    else
    return this.baseStyle}
    Field:
    Code:
    title: "DEL",  type:"text"
    Style:
    Code:
    input.groovybutton
    {
       font-size:10px;
       font-family:Trebuchet MS,sans-serif;
       font-weight:bold;
       color:#FFFFFF;
       height:19px;
       background-color:#0077BB;
       border-style:none;
    }
    Nothing is shown without data attached to the field. And just data is shown if it is attached.

    Thanks

    #2
    I am using some similar in my code. It might help you
    {name:"remove",title:'Remove',type:"date",canEdit:true,
    formatCellValue : function (value, record, rowNum, colNum) {
    if (value==null || isc.isAn.emptyString(value)) return;
    if (value ==1)
    return isc.Canvas.imgHTML("rebuttal_icon.jpg",17,18);

    } }

    I wanna put this icon for newly added row so value is not attahched with data.

    Comment


      #3
      So, is it working for you?

      Comment


        #4
        am getting button but still working on to attach click functionaliy to remove currnt record from grid

        Comment


          #5
          Here is code I am using to catch a click on the image:
          Code:
          .....
          cellClick: 
          function (record, rowNum, colNum) 
          {
          if (colNum == 4)
          alert(1);
           },
          ....
          HTH.

          Comment


            #6
            I did the same but its not deleting my current row .
            I am using this

            cellClick: function(record,rowNum,colNum) {
            //if (colNum ==7 )
            {

            var curRec = this.dhuTab.resultList.getEditedRecord(rowNum);
            alert(rowNum +", "+colNum+", "+isc.echoAll(curRec));
            //this.dhuTab.resultList.selectRecord(curRec);
            this.dhuTab.resultList.data.remove(curRec);
            this.dhuTab.resultList.markForRedraw();

            }
            },

            Comment


              #7
              My ListGrid is bound to local data.
              Here is how I am deleting the record:
              Code:
              cellClick: 
              function (record, rowNum, colNum)
              {
                     if (colNum == 4 && record != null)
                      {
              	        record.file_id = -1;
              	        this.removeData(record)
                      }
              }
              Works with no problem to me.

              Comment

              Working...
              X