레일에있는 루비에서 2 개의 부분을 업데이트하려고합니다.이벤트가있는 부분 렌더링의 응답이 작동하지 않습니다.
show.html.erb :
<div id="filters"><%= render :partial => "pricelistfilters" %></div>
pricelistfilters.html.erb :
<% @properties.each do |prop| %>
#Render the page on properties (and the newproperties)
#<select ...><option>...</option><option>...</option>
#</select>
<% end %>
products.js - 렌더링 부분
용> 이벤트$(window).ready(function(){
selectionchanges();
});
function selectionchanges(){
$('#filters select').change(function(){
//Doing stuff to send with ajax
//Ajax:
$.ajax({
url: document.URL,
type: 'POST',
data: params
});
});
}
products_controller.rb - 변경 내용을 처리 할 수> 코드는
def show
#Changing the properties (and the pricelist properties)
@properties #is filled
@newproperties #is filled
respond_to do |format|
format.html
format.js
end
end
show.js.erb했다
$('#filters').html('<%= escape_javascript(render :partial => "pricelistfilters") %>');
selectionChanges();
내 렌더링 항목이 완벽하게 좋은 것입니다. 그러나 렌더링 된 항목에 대해 적절한 응답을 얻었을 때 더 이상 아약스를 보내지 않습니다. 그래서 내가 선택한 아이템에 대한 이벤트는 사라졌지 만, "selectionchanges();로 리셋했습니다. 내 show.js.erb 파일 끝나고?
누구든지 해결책을 찾을 수 있습니까? 사전에
인사와 감사
코드 블록이 이상하게 작동하고있었습니다. [email protected]로 나를 도와주세요! – ReBa
반갑습니다. 나는 당신이 당신의 문제에 대해 좋은 대답을 찾길 바랍니다. – jdl
'selectionchanges'AND 'selectionChanges', 오타입니다? – RadBrad