leikind / wice_grid

A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters
MIT License
537 stars 215 forks source link

Wice grid working on one controller and not working on another controller #207

Closed ddpdevang closed 9 years ago

ddpdevang commented 9 years ago

The problem that I have is my grid is working on one controller that is products while not working on the invoices controller...

Dont understand what the problem really is... DOne everything the same way...

Gem version that I am using is latest...

leikind commented 9 years ago

Normally when submitting any report you should give the controller code for the grid, the view code, and any error stacktraces if present.

leikind commented 9 years ago

No information given, closing

ddpdevang commented 9 years ago

invoices_controller.rb

 def index
    @invoices = initialize_grid(Invoice)
  end

index.html.erb

<p id="notice"><%= notice %></p>
<%- model_class = Invoice -%>
<div class="page-header">
  <h1><%=t '.title', :default => model_class.model_name.human.pluralize.titleize %></h1>
</div>
<%= grid(@invoices, show_filters: 'always') do |g| 

  g.column name:  'Due Date' do |task| 
    h task.send("due_on")
  end 
  g.column name:  'Status' do |task| 
    @statusValsMap[task.Status] 
  end
  g.column name:  'Amount' do |task| 
    number_to_currency task.total*0.01, {:unit => "£"}
  end 
  g.column name:  'Cutoff' do |task| 
    h task.send("cutoff_on")
  end 
  g.column name:  'Show' do |task|
    link_to('Show', task )
  end
  g.column name:  'Edit' do |task|
    link_to('Edit',:action => 'edit', :id => task )
  end
  g.column name:  'Destroy' do |task|
    link_to('Destroy',{ :action => 'destroy',:id =>task}, :confirm => 'Are you sure?' )
  end
 end -%>

<br>

<%= link_to 'New Invoice', new_invoice_path %>
ddpdevang commented 9 years ago

screenshot

screenshot-1

ddpdevang commented 9 years ago

Below is the screenshot of the thing on one controller where it is working:

screenshot-2

Please Help

As it is getting more and more critical to have this working

leikind commented 9 years ago

Please copy paste the HTML source code of both pages somewhere, for instance, into github gists.

ddpdevang commented 9 years ago

https://gist.github.com/ddpdevang/92978cdfdd74e3e4fcdd

https://gist.github.com/ddpdevang/a63372bb01b7318a059a

leikind commented 9 years ago

I meant the HTML code of the page, not ERB templates

ddpdevang commented 9 years ago

Please check the links again...

leikind commented 9 years ago

Why is your page https://gist.github.com/ddpdevang/a63372bb01b7318a059a incomplete, there is no declaration, there is no html header with all <script src=""></script> tags? Of course this page won't work.

ddpdevang commented 9 years ago

I dont understand why that is not coming... the template for both the layout is the same then also...

Any clue on why it might not be coming

leikind commented 9 years ago

I have no idea, and why you have no layout for a certain controller has absolutely no relation to WiceGrid. WiceGrid cannot work without its JavaScript file. I help solve WiceGrid problems.