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'
IDTitleDescriptionArchivedDue Date
1-20 / 500 show all
325perferendis pariaturEst voluptas explicabo id consequatur autem et voluptatum nobis.No2016-01-06Edit
414quo architecto nonLaudantium iusto dolor facere vero provident sunt.Yes2016-01-07Edit
352autemUt provident voluptates dolor.No2016-01-08Edit
171qui est etEt temporibus sed maiores.No2016-01-08Edit
253quosAut fuga qui excepturi ut tempora dolor voluptatem.Yes2016-01-08Edit
59alias liberoRepudiandae praesentium aut nobis saepe.No2016-01-09Edit
206quia ipsum maximeEum quia expedita quo quia.No2016-01-09Edit
14repellat consequatur velitError autem et deleniti nihil maxime voluptatem eius eveniet.No2016-01-10Edit
366debitis nihil quidemMolestiae est consequatur itaque est maiores vero.No2016-01-10Edit
110hicVoluptate quia quo sed.No2016-01-11Edit
454similique enim odioEa cupiditate sit ex aut laudantium voluptatem.No2016-01-11Edit
178molestias voluptas quiIn tempora quam expedita officiis quod.No2016-01-11Edit
194quoQuis fugiat aperiam sapiente veniam provident odio inventore qui.No2016-01-12Edit
353rerum nam eligendiUt qui omnis at ducimus id non perferendis qui.Yes2016-01-12Edit
82utEt debitis enim repellat qui voluptatem a nam nisi.No2016-01-12Edit
417provident eumEos temporibus animi voluptate quia a aut vel.No2016-01-14Edit
424non autem solutaConsectetur omnis excepturi cum vitae.No2016-01-14Edit
290voluptasIste aut occaecati quo voluptates facere consequatur.No2016-01-15Edit
211et dictaExpedita tempore numquam unde ut quaerat iure est.No2016-01-17Edit
222voluptasAnimi odio ad et nisi quod perferendis natus possimus.No2016-01-17Edit

Fork me on GitHub