0 Replies Latest reply: May 28, 2013 7:12 AM by slornitzo RSS

    How can I remove the pagination controls in <cfgrid> but leave the delete button

    slornitzo Community Member

      I have a <cfgrid> (coldfusion 8) and I am trying to remove the pagination controls (There will only ever be 1 page) but leave the delete button.

      Or alternatively,  remove the footer (which I figured out how to do) and add the delete button to each row.

      (And yes I need the grid)

      I've tried overriding the CSS  both with  a <style> tag on the page and Ive also tried using a function calleled on load to change the disply to none  (which works in firebug when I manually do it)

      Neither seem to work. I;ve searched all over and tried various things, but nothing seems to accomplish waht I need. Any help would be most appreciated.

       

      ****Code***********

       

      <cfajaxproxy cfc="AddSelectedOptions" jsclassname="AddSelectedOptions">

      <cfajaxproxy

          cfc = "AddSelectedOptions"

          jsclassname = "AddSelectedOptions">

      <html>

          <head>

         

          <cfajaximport tags="cfgrid"/>

          <script type="text/javascript">

      var cfc = new AddSelectedOptions();   

      //cfc.setErrorHandler(showError);

      cfc.setCallbackHandler(handleResult);

       

       

         

          function showWin(){

              alert('Button 1 works!!! :-)');

          }   

          function showWin2(){

              alert('Button 2 works!!! :-)');

          }

       

      function delSelected()

              {

                  var selectedRecord = grid.getSelections();

                  var delID = selectedRecord[0].data.ID;           

                  if(confirm('Delete User : ' + selectedRecord[0].data.FIRSTNAME))

                  {

                      cfc.delSelectedCats(delID);

                  };

              }

       

        function AddSelected(SessionId)

      {

      var Cat = document.getElementById("SelCategory");

      var CatSelIndex =Cat.selectedIndex;

      var CatId = Cat.options[CatSelIndex].value;

       

       

      var SubCat = document.getElementById("SelSubCat");

      var SubCatSelIndex =SubCat.selectedIndex;

      var SubCatId = SubCat.options[SubCatSelIndex].value

       

        cfc.AddSelectedOptions(CatId,SubCatId ,SessionId);

       

       

      }

       

      function handleResult(res)

      {           

      ColdFusion.Grid.refresh('SelectedCategories',false);   

      }

       

      var gridRender = function()

          

                      {

              grid = ColdFusion.Grid.getGridObject('SelectedCategories');   //Get grid object

              //overwrite existing grid footer with new div, Ext.id() will assign unique id to footer

              var bbar = Ext.DomHelper.overwrite(grid.bbar,{tag:'div',id:Ext.id()},true);

              //Create new PaginToolbar and render it to bbar (grid footer)

              gbbar = new Ext.PagingToolbar({

                 renderTo:bbar,

                 store: grid.store,

          

                          pageSize: 10,

          

                          displayInfo: true,

          

                          displayMsg: '<b>Showing {0} - {1} out of {2}</b>',

          

                          emptyMsg: "<b>No Record</b>"

          

                          });

          

            };

       

      </script>

      <style >

      #ext-gen67{Display:None;visibility:hidden;};

      #ext-gen59{Display:None;visibility:hidden;};

      #ext-gen75{Display:None;visibility:hidden;};

      #ext-gen76{Display:None;visibility:hidden;};

      #ext-gen79{Display:None;visibility:hidden;};

       

      </style>

      </head>

      <body>

       

      <cfform action="" method="post">

       

      Select Category and Subcategory

      <table>

      <tr>

      <th>Category</th><td colspan="2">

      <cfselect name="SelCategory"

      bind="cfc:AddIncident.Categories()"

      bindonload="true"

      id="SelCategory"

      class="field_150"

      style="width:150px;"/>

      </td>

      <th>SubCategory</th>

      <td colspan="2">

      <cfselect name="SelSubCat"

      bind="cfc:AddIncident.SubCategories({SelCategory})"

      bindonload="true"

      class="field_150"

      id="SelSubCat"

      onChange="AddSelected('999');"/> 

      </td>

      </tr>

      </table>

      <h4>Click on a row and select delete to remove.. will figure out how to add a delete button to each row</h4>

      <cfgrid

      name = "SelectedCategories"

      format="html"

      bindOnLoad="yes"

      bind="cfc:SelectedOptions.getSlectedGrid({cfgridpage},{cfgridpagesize},{cfgridsortcolumn}, {cfgridsortdirection},'999')"

      preservePageOnSort="true"

      selectmode="edit"

      delete="yes"

      DeleteButton="Delete"

      selectOnLoad="no"

      font="Verdana"

      fontsize="11"

      label="True"

      stripeRows="true"

      stripeRowColor="##D9CCFF"

      selectColor="##994FE6"

      pagesize="5"

      onChange="cfc:AddSelectedOptions.delSelectedCats({cfgridaction},{cfgridrow},{cfgridchanged })"

      >

      <cfgridcolumn name="PK_SELECTIONID" display="no" >

      <cfgridcolumn name="SELECTION1DESC" display="yes" header="Category" mask="EEE DD-MMM-YY H:NN A">

      <cfgridcolumn name="SELECTION2DESC"  display="yes" header="SubCategory">

      <cfgridcolumn name="Delete"  display="yes" header="Delete">

      </cfgrid>

      </cfform>

       

      <cfset ajaxOnLoad("init")>