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

How to refresh grid contents from javscript #213

Closed catogonzalez closed 9 years ago

catogonzalez commented 9 years ago

I have a treeview where the end user selects (clicks-on) a "partner" whose "territories" will be populated on a wice_grid on the same page. When the user clicks on a tree node I make an ajax GET handled by a rails controller with this:

class TerritoriesController < ApplicationController
...

def by_partner
    partner = Seller.find(params[:id])
    @territories_grid = initialize_grid(Territory.owned_by(partner), include: [:sellers, :city, :region])
    respond_to do |format|
      format.js { render :layout => false }
    end
  end
end

The controller does select the appropriate territories but the grid is not updated upon ajax call completion. How can I force a refresh or re-init of the grid so that it renders the new rows?

leikind commented 9 years ago

You have to reload the page. That's how WiceGrid works