To manage a list of about 800 entries i use a form with droplists to filter out various custom fields, including two custom dates. Result is filtered with expressionengines dynamic_parameters.
{exp:channel:entries
channel="jobb_ticket"
search:display="published|updated|delivered"
status="Open|Closed"
limit="9999"
dynamic_parameters="search:namn|search:produkt|search:kund|search:producent|search:materialdag|search:utgivningsdag" orderby="materialdag|utgivningsdag"
date_field="materialdag"
date_field_start="<? if(!empty($_POST['startdate'])){echo date('Y-m-d H:i', $_POST['startdate']);} ?>"
date_field_stop="<? if(!empty($_POST['startdate'])){echo date('Y-m-d H:i', $_POST['startdate'] + 604799);} ?>"
sort="asc|asc"
}
The filtered list contains after each row a submit button, to be able to edit some of the custom fields, linked to a fancybox containing a safecracker form.
in the html:
<div class="col_btn_registrera"><a class="registrera_produkt fancybox.ajax" href="{site_url}client/client_register_ajax/index_thewineagency/{entry_id}"><input type="submit" name="" value="Registrera" /></a></div>
In the header
$('.registrera_produkt').fancybox({
Width : 340,
Height : 100,
autoDimensions : false
});
In the fancybox the safecracker form
<html>
<head>
[removed]
$(document).ready(function(){
$('#publishForm').ajaxForm({
dataType: 'json',
success: function(data) {
if (data.success) {
} else {
alert('Failed with the following errors: '+data.errors.join(', '));
}
}
});
});
$('#publishForm').submit(function(){
$.fancybox.close();
$(parent.document)[0].location.reload(true);
return false;
});
[removed]
<link href="{path=css/_ee_saef_css}" type="text/css" rel="stylesheet" media="screen">
<link href="{site_url}css/gridlocker.css" rel="stylesheet" type="text/css">
</head>
<body>
{exp:safecracker include_jquery="no" channel="jobb_ticket" entry_id="{last_segment}"}
<input type="text" name="produkt" id="produkt" value="{produkt}">br>
<input type="submit" name="submit_button" id="submit_button" value="Uppdatera">
{/exp:safecracker}
</body>
</html>
the record does get updated and the fancybox window does close the parent page however does not update.
How do i update the parent page after submit but without resetting the filtered result? or how do i initiate a new search with last used form values?
Is there a better way of doing it?
kindly asking for help
ralph
You would probably have to make an AJAX call and retrieve the updated list and replace the list that was on the parent page.