Datagrid Jquery PHP, mi servirebbero alcune soluzioni... Insrimento immagine e filtro

Ivano Cardassi

Nuovo Utente
23 Nov 2013
14
0
0
Magione (Italia), Italy
Buongiorno a tutti. Prima di tutto ho cercato la sezione presentati e non l'ho vista (neanche con 2 paia di occhiali), quindi mi scuso prima con tutti gli utenti e moderatori... So che non è educato...

Spiego il motivo della discussione:

Ho un datagrid adattato da Jquery in php con mysql.
Premetto che funzona tutto molto bene... Solo che volevo ampliarlo con 2 funzioni ma non riesco a farlo funzionare...

1) Ho una Mastergrid, che al premere del + mi si apre la subgrid con altre info... bene, avrei la necessità di inserire una o più immagini e dei pdf... La parte teorica a grandi linee la conosco, non riesco ad inserirla...

2) Volevo creare un filtro range valori da... a....
ho due campi form dove inserisco il valore minimo e massimo... quando premo il pulsante cerca, il datagrid mi dovrebbe visualizzare i campi scelti...

Ho già dei filtri sulla riga che funzionano a dovere, ma dovrei ampliare il filtro anche con questa...

se volete posto il codice...

Grazie tante a chi mi vorrà aiutare...

un saluto a tutti
 

Ivano Cardassi

Nuovo Utente
23 Nov 2013
14
0
0
Magione (Italia), Italy
Sbadato,,, già avevo salutato... allora risaluto di nuovo...

inserisco il codice cosicchè mi potrete aiutare:

questa è la home...

Codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="keywords" content="jquery,ui,easy,easyui,web">
	<meta name="description" content="easyui help you build your web page easily!">
	<title>Stock Auto Usate</title>
    
	<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css">
    <style type="text/css">
.bottone {
	-moz-box-shadow:inset 0px 1px 0px 0px #f29c93;
	-webkit-box-shadow:inset 0px 1px 0px 0px #f29c93;
	box-shadow:inset 0px 1px 0px 0px #f29c93;
	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #fe1a00), color-stop(1, #ce0100) );
	background:-moz-linear-gradient( center top, #fe1a00 5%, #ce0100 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fe1a00', endColorstr='#ce0100');
	background-color:#fe1a00;
	-webkit-border-top-left-radius:10px;
	-moz-border-radius-topleft:10px;
	border-top-left-radius:10px;
	-webkit-border-top-right-radius:10px;
	-moz-border-radius-topright:10px;
	border-top-right-radius:10px;
	-webkit-border-bottom-right-radius:0px;
	-moz-border-radius-bottomright:0px;
	border-bottom-right-radius:0px;
	-webkit-border-bottom-left-radius:0px;
	-moz-border-radius-bottomleft:0px;
	border-bottom-left-radius:0px;
	text-indent:0px;
	border:1px solid #d83526;
	display:inline-block;
	color:#ffffff;
	font-family:Arial;
	font-size:15px;
	font-weight:bold;
	font-style:italic;
	height:35px;
	line-height:35px;
	width:80px;
	text-decoration:none;
	text-align:center;
	text-shadow:2px 3px 0px #b23e35;
}
.bottone:hover {
	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ce0100), color-stop(1, #fe1a00) );
	background:-moz-linear-gradient( center top, #ce0100 5%, #fe1a00 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ce0100', endColorstr='#fe1a00');
	background-color:#ce0100;
}.bottone:active {
	position:relative;
	top:1px;
}</style>

	<style type="text/css">
		#fm{
			margin:0;
			padding:10px 30px;
		}
		.ftitle{
			font-size:14px;
			font-weight:bold;
			color:#666;
			padding:5px 0;
			margin-bottom:10px;
			border-bottom:1px solid #ccc;
		}
		.fitem{
			margin-bottom:5px;
		}
		.fitem label{
			display:inline-block;
			width:80px;
			text-align: right;
		}
	</style>
    <style>
		.icon-filter{
			background:url('images/filter.png') no-repeat center center;
		}
	</style>
	<script type="text/javascript" src="js/jquery-1.6.min.js"></script>
	<script type="text/javascript" src="js/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="js/datagrid-filter.js"></script>
    <script type="text/javascript" src="js/jquery.edatagrid.js"></script>
    <script type="text/javascript" src="js/datagrid-bufferview.js"></script>
   <script type="text/javascript" src="http://www.jeasyui.com/easyui/datagrid-scrollview.js"></script>
    <script type="text/javascript" src="http://www.jeasyui.com/easyui/datagrid-detailview.js"></script>
	<script type="text/javascript">
	
		var url;
		function newUser(){
			$('#dlg').dialog('open').dialog('setTitle','Nuova Auto');
			$('#fm').form('clear');
			url = 'save_user.php';
		}
		function sposta(){
			var row = $('#dg').datagrid('getSelected');
			if (row){
			$('#dlg').dialog('open').dialog('setTitle','Esporta Auto');
			$('#fm').form('load',row);
			url = 'save_user1.php';
		}
		
		}
		
		function editUser(){
			var row = $('#dg').datagrid('getSelected');
			if (row){
				$('#dlg').dialog('open').dialog('setTitle','Modifica Auto');
				$('#fm').form('load',row);
				url = 'update_user.php?id='+row.id;
			}
		}
		function saveUser(){
			$('#fm').form('submit',{
				url: url,
				onSubmit: function(){
					return $(this).form('validate');
				},
				success: function(result){
					var result = eval('('+result+')');
					if (result.success){
						$('#dlg').dialog('close');		// close the dialog
						$('#dg').datagrid('reload');	// reload the user data
					} else {
						$.messager.show({
							title: 'Error',
							msg: result.msg
						});
					}
				}
			});
		}
		function regsposta(){
			$('#fm').form('submit',{
				url: url,
				onSubmit: function(){
					return $(this).form('validate');
				},
				success: function(result){
					var result = eval('('+result+')');
					if (result.success){
						$('#dlg').dialog('close');		// close the dialog
						$('#dg').datagrid('reload');	// reload the user data
					} else {
						$.messager.show({
							title: 'Error',
							msg: result.msg
						});
					}
				}
			});
			var row = $('#dg').datagrid('getSelected');
			if (row){
				$.messager.confirm('Conferma','Sicuro di rimuovere?',function(r){
					if (r){
						$.post('remove_user.php',{id:row.id},function(result){
							if (result.success){
								$('#dg').datagrid('reload');	// reload the user data
							} else {
								$.messager.show({	// show error message
									title: 'Errore',
									msg: result.msg
								});
							}
						},'json');
					}
				});
			}
		}
		function removeUser(){
			var row = $('#dg').datagrid('getSelected');
			if (row){
				$.messager.confirm('Conferma','Sicuro di rimuovere?',function(r){
					if (r){
						$.post('remove_user.php',{id:row.id},function(result){
							if (result.success){
								$('#dg').datagrid('reload');	// reload the user data
							} else {
								$.messager.show({	// show error message
									title: 'Errore',
									msg: result.msg
								});
							}
						},'json');
					}
				});
			}
		}
	</script>
    <script type="text/javascript">
        $(function(){
            $('#dg').datagrid({
                view: detailview,
				detailFormatter: function(rowIndex, rowData){
					return '<table><tr>' +
							'<td rowspan=2 style="border:0"><"rowData.id" style="height:50px;"></td>' +
							'<td style="border:0">' +
							'<p>Proprietario: ' + rowData.Marca + '</p>' +
							'<p>Modello: ' + rowData.Modello + '</p>' +
							'</td>' +
							'</tr></table>';
				}
            });
        });
    </script>
    
    
    
    
   <script>
		var data = [
           	{"productid":"FI-SW-01","productname":"Koi","unitcost":10.00,"var":"LI","status":"P","listprice":36.50,"attr1":"Large","itemid":"EST-1"},
        	
        ];
		$(function(){
			var dg = $('#dg').datagrid({
				filterBtnIconCls:'icon-filter'
			});
			dg.datagrid('enableFilter', [{
				field:'listprice',
				type:'numberbox',
				op:['equal','notequal','less','greater']
			},{
				field:'var',
				type:'text',
				options:{precision:1},
				op:['equal','notequal','less','greater']
			
			},{
				field:'productname',
				type:'text',
				options:{precision:1},
				op:['equal','notequal','less','greater']
			
			},{
				field:'itemid',
				type:'text',
				options:{precision:1},
				op:['equal','notequal','less','greater']
			
			},{
				field:'attr1',
				type:'text',
				options:{precision:1},
				op:['equal','notequal','less','greater']
			
			},{
				field:'unitcost',
				type:'numberbox',
				options:{precision:1},
				op:['equal','notequal','less','greater']
			
			},{
				field:'unitcost',
				type:'numberbox',
				options:{precision:1},
				op:['equal','notequal','less','greater']
			
			},{
				field:'productid',
				type:'text',
				options:{precision:1},
				op:['equal','notequal','less','greater']
			
			},{
				field:'status',
				type:'text',
				options:{precision:1},
				op:['equal','notequal','less','greater']
			
			}]);
		});
	</script>
    
    </head>
<body>
    </head>
<body>
<h2>Stock In Rientro</h2>
<a href="http://www.nuovo2014.esy.es/listeonline/indexopen.html" class="bottone">Home </a>
<table width="1357" class="easyui-datagrid" id="dg" style="width:1300px;height:500px" title="Admin"
			data-options="pageSize:500"
            url="get_users.php"
			toolbar="#toolbar" pagination="true"
			rownumbers="true"  singleSelect="true">
	<thead>			<tr>
				
                <th field="Marca" width="78" sortable="true">Marca</th>
				<th field="Modello" width="84" sortable="true">Modello</th>
                <th field="Allestimento" width="159"sortable="true">Allestimento</th>
                <th field="Tipo" width="27"sortable="true">Tipo</th>
                <th field="Colore" width="74"sortable="true">Colore</th>
                <th field="Accessori" width="152"sortable="true">Accessori</th>
                <th field="Alim" width="29"sortable="true">Alim</th>
                <th field="Km" width="50"sortable="true">Km</th>
                <th field="Anno" width="41"sortable="true">anno</th>
                <th field="Rif" width="35"sortable="true">Rif</th>
                <th field="Prop" width="105"sortable="true">Proprietario</th>
                <th field="Vendita" width="53"sortable="true">Vendita</th>
                <th field="Targa" width="66"sortable="true">Targa</th>
                <th field="Carico" width="47"sortable="true">Carico</th>
                <th field="Ubi" width="38"sortable="true">Ubic.</th>
                <th field="Soc" width="29"sortable="true">Soc</th>
                <th field="Note" width="157"sortable="true">Note</th>
			
			</tr>
		</thead>
	</table>
    
    
	<div id="toolbar">
		<a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newUser()">Nuovo</a>
		<a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editUser()">Modifica</a>
		<a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="removeUser()">Cancella</a>
        <a href="#" class="easyui-linkbutton" iconCls="icon-ok" plain="true" onclick="sposta()">Auto rientrata | </a>
	
   <form id"filtraprezzo">
   <div class="fitem", style="float:left">
				<label>Prezzo da €:</label>
				<input name="da1">
			</div>
			<div class="fitem", style="float:left">
				<label> a €:</label>
				<input name="a2">
			</div>
            <input type="submit" name="Filtra" value="Filtra">
            </form>
        
			
		</div>
	<div id="dlg" class="easyui-dialog" style="width:800px;height:450px;padding:5px 10px"
			closed="true" buttons="#dlg-buttons">
		<div class="ftitle">Info</div>
		<form id="fm" method="post" enctype="multipart/form-data" novalidate>
			<div class="fitem", style="float:left">
				<label>Marca:</label>
				<input name="Marca">
			</div>
			<div class="fitem", style="float:left">
				<label> Modello:</label>
				<input name="Modello">
			</div>
            <div class="fitem", style="float:left">
				<label>Allestimento:</label>
				<input name="Allestimento">
			</div>
			<div class="fitem", style="float:left">
           	  <label>Tipo:</label>
				<input name="Tipo">
			</div>
            <div class="fitem", style="float:left">
				<label>Colore:</label>
				<input name="Colore">
			</div>
            <div class="fitem", style="float:left">
				<label>Accessori:</label>
				<input name="Accessori">
			</div>
            <div class="fitem", style="float:left">
				<label>Alimen.:</label>
				<input name="Alim">
			</div>
            <div class="fitem", style="float:left">
				<label>Km:</label>
				<input name="Km">
			</div>
			<div class="fitem">
				<label>Anno:</label>
				<input name="Anno">
			</div>
            <div class="fitem", style="float:left">
				<label>Rif. Int.:</label>
				<input name="Rif">
			</div>
            <div class="fitem", style="float:left">
				<label>Proprietario:</label>
				<input name="Prop">
			</div>
            <div class="fitem", style="float:left">
				<label>Vendita €:</label>
				<input name="Vendita">
			</div>
            <div class="fitem", style="float:left">
				<label>Targa:</label>
				<input name="Targa">
			</div>
            <div class="fitem", style="float:left">
				<label>Carico €:</label>
				<input name="Carico">
			</div>
            <div class="fitem", style="float:left">
				<label>Ubicazione:</label>
				<input name="Ubi">
			</div>
            <div class="fitem", style="float:left">
				<label>Societa':</label>
				<input name="Soc">
			</div>
            <div class="fitem", style="float:left">
				<label>Note:</label>
				<input name="Note">
			</div>
            <div class="fitem", style="float:left">
            <p>Seleziona un file da memorizzare nel database:</p>
				<form name="upload" enctype="multipart/form-data" method="post" 			action="write_db.php"> 
<p>
<input type="file" name="file_inviato">
<input type="submit" name="invia" value="Invia file">
</p> 
</form>
			</div>
		</form>
	</div>
	<div id="dlg-buttons">
		<a href="#" meta http-equiv="refresh" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveUser()">Salva</a>
		<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">Cancella</a>
        <a href="#" meta http-equiv="refresh" class="easyui-linkbutton" iconCls="icon-ok" onclick="regsposta()">Sposta</a>
	</div>
    
</body>
</html>