<script>
	$j(function(){
		var tn = 'marchandises';

		/* data for selected record, or defaults if none is selected */
		var data = {
			fournisseur: <?php echo json_encode(array('id' => $rdata['fournisseur'], 'value' => $rdata['fournisseur'], 'text' => $jdata['fournisseur'])); ?>,
			provenance: <?php echo json_encode(array('id' => $rdata['provenance'], 'value' => $rdata['provenance'], 'text' => $jdata['provenance'])); ?>
		};

		/* initialize or continue using AppGini.cache for the current table */
		AppGini.cache = AppGini.cache || {};
		AppGini.cache[tn] = AppGini.cache[tn] || AppGini.ajaxCache();
		var cache = AppGini.cache[tn];

		/* saved value for fournisseur */
		cache.addCheck(function(u, d){
			if(u != 'ajax_combo.php') return false;
			if(d.t == tn && d.f == 'fournisseur' && d.id == data.fournisseur.id)
				return { results: [ data.fournisseur ], more: false, elapsed: 0.01 };
			return false;
		});

		/* saved value for provenance */
		cache.addCheck(function(u, d){
			if(u != 'ajax_combo.php') return false;
			if(d.t == tn && d.f == 'provenance' && d.id == data.provenance.id)
				return { results: [ data.provenance ], more: false, elapsed: 0.01 };
			return false;
		});

		cache.start();
	});
</script>

