Announcement

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

    Event handler for ListGrid add/remove records?

    I'm creating a CanvasItem whose canvas is a ListGrid. For this purpose, I need to track whenever the ListGrid changes so that I can call storeValue. The callback cellChanged captures most events, but it does not get called when records are added or removed. None of the event handlers I found seemed appropriate.

    Do you have a suggestion for how to do this?

    I'm using "v9.1p_2015-07-08/Pro Deployment".

    Code:
    var lg = isc.ListGrid.create({
       autoDraw:true,
       dataSource: isc.DataSource.create({
          clientOnly:true,
          fields:[
             {hidden: true,name: "id",primaryKey: true},
             {name:"a",title:"A",
              changed: function(f,i,v){
                 console.log("changed3");
              }
             }
          ],
       }),
       saveLocally:true,
       data:[                                                                                                        
          {id:1,a:"1"},
          {id:2,a:"2"},
          {id:3,a:"3"},
       ],
       canEdit: true,
       editByCell: true,
       canRemoveRecords: true,
       cellChanged : function () {
          console.log("cellChanged",this.data);
       },
       viewStateChanged: function(){
          console.log("vsc");
       },
       fieldStateChanged: function(){
          console.log("fsc");
       }
    });
    
    isc.Button.create({
       autoDraw:true,
       title: "New",
       top:100,
       click: function(){
          lg.addData({a:"new"});
       }
    });

    #2
    dataChanged fires in this circumstance.

    Comment


      #3
      That works. Thanks!

      I try to avoid asking questions I should be able to figure out myself, but I don't see how I could have discovered this from the SmartClient Reference. One idea could be to use dataChanged instead of cellChanged in your CanvasItem - Nested Editor example.

      Comment


        #4
        For future readers of this post, I needed to add this line to my dataChanged implementation because otherwise the visual wasn't being updated.

        Code:
        this.Super("dataChanged",arguments);

        Comment

        Working...
        X