WiceGrid 3.6.0.pre4 examples

External submit/reset buttons

To replace the default Submit and Reset icons of the grid, add class wg-external-submit-button to any clickable element on page and set its attribute data-grid-name to the name of the grid. Do the same for the Reset button with class wg-external-reset-button.

grid helper parameters hide_submit_button: true and hide_reset_button: true hide the default icons.

  • # encoding: utf-8
    class ButtonsController < ApplicationController
      def index
        @tasks_grid = initialize_grid(Task)
      end
    end
    
  • <%= grid(@tasks_grid, hide_submit_button: true, hide_reset_button: true) do |g|
    
      g.column name:  'ID', attribute: 'id', filter: false
    
      g.column name:  'Title', attribute: 'title'
    
      g.column  name:  'Description', attribute: 'description'
    
      g.column  name:  'Archived', attribute: 'archived' do |task|
        task.archived? ? 'Yes' : 'No'
      end
    
      g.column name:  'Due Date', attribute: 'due_date', filter: false
    
    
      g.column   do |task|
        link_to('Edit', edit_task_path(task))
      end
    
    end -%>
  • .well
      %h2= current_page_title
      %p
    
        To replace the default Submit and Reset icons of the grid, add class
        %code wg-external-submit-button
        to any clickable element on page and set its attribute
        %code data-grid-name
        to the name of the grid.
        Do the same for the Reset button with class
        %code wg-external-reset-button.
    
      %p
        %code grid
        helper parameters
        %code hide_submit_button: true
        and
        %code hide_reset_button: true
        hide the default icons.
    
    = show_code
    
    .row-fluid
      .col-md-12
        .external-buttons
          %button.btn.btn-primary.wg-external-submit-button{'data-grid-name' => 'grid'} Submit
          %button.btn.btn-default.wg-external-reset-button{'data-grid-name' => 'grid'} Reset
    
    
        = render   'grid'
IDTitleDescription ArchivedDue Date
1-20 / 500 show all
209fugaA amet qui quas aliquam neque.Yes2016-03-01Edit
287sint non dolorAb aut rerum ut sequi tenetur voluptate repellat non.No2016-05-10Edit
204error earum quiAb labore rerum quisquam rerum enim magni.No2016-08-28Edit
429ipsamAccusamus a vel suscipit facere officia doloribus.No2016-03-17Edit
403et praesentium temporeAccusamus omnis odit in cumque soluta aliquam.No2016-10-20Edit
452illum et voluptatemAccusamus quis quis sapiente distinctio aut et quaerat asperiores.Yes2016-02-03Edit
294fugiat evenietAccusamus ut et nesciunt sit corrupti.No2016-06-10Edit
415voluptatemAccusantium mollitia dolorem nesciunt ipsa libero dolor.No2016-06-16Edit
74molestiaeAd dolores occaecati fuga ratione praesentium quo.No2016-03-05Edit
69similique placeat ipsaAlias ratione autem ut impedit non nihil itaque eaque.No2016-03-19Edit
336aut quis aspernaturAliquam fuga similique facilis accusamus reprehenderit.No2016-04-21Edit
130esse rationeAliquid dolore aut magnam voluptatum ad.No2016-04-14Edit
431vitae repudiandaeAliquid nihil aliquam architecto eos delectus placeat.No2016-05-21Edit
321quis est autemAmet veniam quia molestias eum modi impedit rerum ad.No2016-03-09Edit
413voluptateAnimi esse amet nihil ad nobis voluptatum.No2016-03-10Edit
222voluptasAnimi odio ad et nisi quod perferendis natus possimus.No2016-01-17Edit
35modiAnimi quod iste sunt.Yes2016-05-08Edit
43impedit atque minimaAperiam expedita autem porro enim veniam.Yes2016-08-15Edit
137molestiaeArchitecto praesentium ut dolorem illo facere rerum numquam provident.Yes2016-01-30Edit
229omnis commodiArchitecto qui voluptatum vel et.No2016-04-26Edit

Fork me on GitHub