I'm trying to render diferents forms or views in a Jquery dialog or a Modal dialog, but the renderPartial does something anoying.
First I tried to update the content of a div or the dialog itself like this:
obviously that code its loaded from a button with an 'onclick' javascript function or an event. But it loads the hole partial view within the main view. This works fine:
Last thing that worked for me using a JQuery Dialog it's the next ajax call:
In the controller I have this:
But its very slow, so I'm wonder if there is a better way to do that. I'm a Rails developer and I'm wonder if there is a way to do something like this:
First I tried to update the content of a div or the dialog itself like this:
$("#modal_body").html("<?php $this->renderPartial("_do_form", array("model" => $model), false,false);?>");
obviously that code its loaded from a button with an 'onclick' javascript function or an event. But it loads the hole partial view within the main view. This works fine:
$("#modal_body").html("Hola");
Last thing that worked for me using a JQuery Dialog it's the next ajax call:
'ajaxOptions' => array( 'success' => 'js:function(data){ $("#dialog_content").html(data); $("#dialog-form").dialog({title: "Establecer Salidas Digitales", position: ["top",75]}); $("#dialog-form").dialog("option", "height", 325); $("#dialog-form").dialog("option", "width", 500); $("#dialog-form").dialog("open"); }'
In the controller I have this:
$newDO = new DigitalOutput; $this->renderPartial('_do_form', array( 'model' => $newDO, ),false,true);
But its very slow, so I'm wonder if there is a better way to do that. I'm a Rails developer and I'm wonder if there is a way to do something like this:
$('#agent2').html("<%= escape_javascript( render(:partial => 'partial_name') ) %>");