Удалить данные из диалогового окна JQuery при закрытии
У меня есть диалоговое окно JQuery для вставки новой строки в таблицу. И все работает хорошо. Несколько дней назад, когда я вставил FlexiGrid для Table, у меня возникла проблема. Когда я вставляю новую строку, диалоговое окно исчезает, но когда я открываю диалоговое окно для новых данных вставки, которые вставляются ранее, все еще в диалоге.
Как сбросить диалоговые поля после того, как я закончу с его использованием.
Код для диалога такой:
$(function() {
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#newDialog-form" ).dialog({
autoOpen: false,
height: 250,
width: 300,
modal: true,
buttons: {
Salva: function() {
$.ajax({
url: 'agendaTipoAppuntamentoSaveJson.do',
type: "POST",
dataType: "json",
data: $("#newDialogForm").serialize(),
success: function(result) {
if (result.esito!='OK') {
alert(result.esito + ' ' + result.message);
}
else {
addNewTipoAppuntamento(
result.insertedTipoApp.idTipoAppuntamento ,
result.insertedTipoApp.codice,
result.insertedTipoApp.descrizione,
result.insertedTipoApp.descrBreve,
result.insertedTipoApp.colore
);
$("#newTable").flexReload();
$( "#newDialog-form" ).dialog( 'close' );
}
},
error:function (xhr, ajaxOptions, thrownError){
alert(xhr.status);
alert(thrownError);
}
});
},
Annula : function() {
$( this ).dialog( "close" );
}
}
});
$( "#newDialog-form" ).dialog({ closeText: '' });
});
Это диалоговая форма:
<div id="newDialog-form" title="Nuovo Tipo Appuntamento" class="inputForm" >
<form id="newDialogForm" action="agendaTipoAppuntamentoSaveJson.do" >
<input type="hidden" name="azione" id="idAzione" value="update" />
<input type="hidden" name="idTipoAppuntamento" id="idTipoAppuntamentoIns" value="-1" />
<fieldset>
<table>
<tr >
<td>
<label for="codiceIns">Codice </label>
</td><td>
<input type="text" name="codice" id="codiceIns" class="text ui-widget-content ui-corner-all"/>
</td></tr><tr>
<td>
<label for="descrizioneIns">Descrizione </label>
</td><td>
<input type="text" name="descrizione" id="descrizioneIns" value="" class="text ui-widget-content ui-corner-all" />
</td></tr><tr>
<td>
<label for="descrBreveIns">descrBreve </label>
</td><td>
<input type="text" name="descrBreve" id="descrBreveIns" value="" class="text ui-widget-content ui-corner-all" />
</td></tr><tr>
<td>
<label for="coloreIns">colore </label>
</td><td>
<input type="text" name="colore" id="coloreIns" value="" class="text ui-widget-content ui-corner-all" />
</td>
</tr>
</table>
</fieldset>
</form>
</div>