javascript - Render action in two different controllers -
i have list of stockmovements , ajax picking list of stock_movements.
my application has ajax search will_paginate , elasticsearch. add list picking list put following code in each column of stockmovement's list:
<%= button_to 'retornar', linha_devolucaos_path(stock_movement_id: stock_movement.id, page: params[:page]), class: 'btn btn-mini' if !stock_movement.back , !stock_movement.linha_devolucaos.present? %> it updates picking list js response of item:
$('#romaneio').html("<%=j render @devolucao %>") in ajax runs fine, doesn't hide retornar button because div isn't updated. know need request js response of stockmovement#index action, how , call action , how pass params?
linhadevolucao#create controller
def create @devolucao = current_devolucao_romaneio stock_movement = stockmovement.find(params[:stock_movement_id]) @devolucao.add_stock_movement(stock_movement.id) respond_to |format| if @devolucao.save format.html { redirect_to stock_movements_path(page: params[:page]), notice: 'linha devolucao created.' } format.json { render json: @linha_devolucao, status: :created, location: @linha_devolucao } format.js else format.html { render action: "new" } format.json { render json: @linha_devolucao.errors, status: :unprocessable_entity } end end end linhadevolucao/create.js
$('#romaneio').html("<%=j render @devolucao %>"); and need update current stockmovement list hide "retornar" button of lines that're in linha_devolucao. stockmovement#index action job, how , redirect action , render js response?
$("#equipments-table").html("<%=j render("equipments") %>");
"<%=j render @devolucao %>") i think: it's not good, must render custom view in stockmovements folder. example:
<%=j render 'devolcao' %> in file can create cycle @devolucao.
but don't know view's files.
Comments
Post a Comment