0 Replies Latest reply on Dec 30, 2011 3:03 PM by waterunderthebridge

    CFGRID and tbar.addButton

    waterunderthebridge

      I've come across two promising tutorials

      http://www.anujgakhar.com/2008/03/18/crud-with-cfgrid-html-format/

      CRUD with cfgrid html format

      which refers to Dan Vega's posts

      http://www.danvega.org/blog/index.cfm/2008/3/5/ColdFusion-8-Grid-Custom-Toolbars

       

      ColdFusion 8 Grid Custom Toolbars

       

      both of which I have consulted and tried their code. In neither case does the toolbar appear.

      I have the correct path in CF 9 to the toolbar.js

      <script type="text/javascript" src="/CFIDE/scripts/ajax/ext/source/widgets/Toolbar.js"></script>

       

      and their code

       

      function init(){

              grid = ColdFusion.Grid.getGridObject("ArtistGrid");

              var gridFoot = grid.getView().getFooterPanel(true);

              var gridHead = grid.getView().getHeaderPanel(true);

             

              var bbar = new Ext.Toolbar(gridFoot);

              var tbar = new Ext.Toolbar(gridHead);

             

              bbar.add(new Ext.Toolbar.TextItem('Total Artists: ' + grid.getDataSource().totalLength));

             

              tbar.addButton({

               text:"Add New Artist",

               cls:"x-btn-text-icon",

               icon:"add.png",

               handler:onAdd

              });

              tbar.addSeparator()

              tbar.addButton({

               text:"Delete Artist",

               cls:"x-btn-text-icon",

               icon:"delete.png",

               handler:onDelete

              });

             

              console.log(tbar);

              console.log(bbar);

       

       

      }

       

       

      function onAdd(button,event){

      alert("Row Added");

       

       

      console.log(button);

      console.log(event);

      }

       

      I've tried this on three different CF 9 Servers, and the tabs do not appear.

       

      Now these posts are a few years old by now and refer to CF 8. It looks as though CF 9 doesn't support the toolbar. Is this correct?

      And if so, is there some replacement for it?

       

      The CFGRID looks really great, and I did get it to sort and actually edit rows(though I'm not sure how I did that), but not delete

      or insert. If I could get the full functionality to work, this could be very valuable.