Location: PHPKode > projects > Livraria Navi - Ej Project > LivrariaNavi.03/includes/lixo/usuariosFlexi.php
<head>
<title>Flexigrid</title>
<link rel="stylesheet" type="text/css" href="lib/flexigrid/css/flexigrid.css" />
<link href="lib/jquery/jqModal.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="lib/jquery/jquery-1.2.6.js"></script>
<script type="text/javascript" src="lib/flexigrid/flexigrid.js"></script>
<script type="text/javascript" src="lib/jquery/jqModal.js"></script>
<script type="text/javascript" src="lib/jquery/dimensions.js"></script>
<script type="text/javascript" src="lib/jquery/jqDnR.js"></script>

<script type="text/javascript">
$(document).ready(function(){
  $('#previewLayer')
   .jqDrag('#handle') //set previewLayer as a jqModal window
   .jqResize('.jqResize')
   .jqm({ajax: '_tablesort.html', trigger: 'a.ex2trigger', target:'#previewContent',modal:true});
  $('input.jqmdX')
   .hover(
    function(){ $(this).removeClass('jqmdXFocus'); },
    function(){ $(this).addClass('jqmdXFocus'); })
   .focus(
    function(){ this.hideFocus=true; $(this).addClass('jqmdXFocus'); })
   .blur(
    function(){ $(this).removeClass('jqmdXFocus'); });
   $('a .ex2triggerx').click(function(){
      alert("Merda");
      });


	$("#flex1").flexigrid
			(
			{
			url: 'usuariosQuery.php',
			dataType: 'json',
			colModel : [
                {display: 'AÇÕES',  width : 40, align: 'right'},
				{display: 'ID', name : 'id', width : 40, sortable : true, align: 'center'},
				{display: 'NOME', name : 'nome', width : 180, sortable : true, align: 'left'},
				{display: 'LOGIN', name : 'login', width : 140, sortable : true, align: 'left'},
				{display: 'ESCOLA', name : 'empresa', width : 120, sortable : true, align: 'left'},
				{display: 'EMAIL', name : 'email', width : 130, sortable : true, align: 'left'},
				{display: 'SEMESTRE', name : 'inicio_processo', width : 80, sortable : true, align: 'right', hide: true}
				],
			buttons : [
				{name: 'Add', bclass: 'add', onpress : test},
				{name: 'Delete', bclass: 'delete', onpress : test},

				{name: 'TODOS', onpress: sortAlpha},
				{separator: true},
				{name: 'A', onpress: sortAlpha},
                {name: 'B', onpress: sortAlpha},
				{name: 'C', onpress: sortAlpha},
				{name: 'D', onpress: sortAlpha},
				{name: 'E', onpress: sortAlpha},
				{name: 'F', onpress: sortAlpha},
				{name: 'G', onpress: sortAlpha},
				{name: 'H', onpress: sortAlpha},
				{name: 'I', onpress: sortAlpha},
				{name: 'J', onpress: sortAlpha},
				{name: 'K', onpress: sortAlpha},
				{name: 'L', onpress: sortAlpha},
				{name: 'M', onpress: sortAlpha},
				{name: 'N', onpress: sortAlpha},
				{name: 'O', onpress: sortAlpha},
				{name: 'P', onpress: sortAlpha},
				{name: 'Q', onpress: sortAlpha},
				{name: 'R', onpress: sortAlpha},
				{name: 'S', onpress: sortAlpha},
				{name: 'T', onpress: sortAlpha},
				{name: 'U', onpress: sortAlpha},
				{name: 'V', onpress: sortAlpha},
				{name: 'W', onpress: sortAlpha},
				{name: 'X', onpress: sortAlpha},
				{name: 'Y', onpress: sortAlpha},
				{name: 'Z', onpress: sortAlpha},
				{name: '#', onpress: sortAlpha}

				],
			actions : [
				{name: 'Add', bclass: 'add', onpress : test},
				{name: 'Delete', bclass: 'delete', onpress : test}
				],


			searchitems : [
				{display: 'NOME', name : 'nome', isdefault: true},
				{display: 'EMPRESA', name : 'empresa'},
				{display: 'ID', name : 'id'}
				],
			sortname: "nome",
			sortorder: "asc",
			usepager: true,
			title: 'Usuários',
			useRp: true,
			rp: 10,
			multiselect: true,
			showTableToggleBtn: true,
			width: 770,
			height: 255
			}
			);

});
function sortAlpha(com)
			{
            if (com=='TODOS')
            com='';
            jQuery('#flex1').flexOptions({newp:1, params:[{name:'letter_pressed', value: com},{name:'qtype',value:$('select[name=qtype]').val()}]});
			jQuery("#flex1").flexReload();
			}


function test(com,grid)
{
    if (com=='Delete')
        {
           if($('.trSelected',grid).length>0){
		   if(confirm('Delete ' + $('.trSelected',grid).length + ' items?')){
            var items = $('.trSelected',grid);
            var itemlist ='';
        	for(i=0;i<items.length;i++){
				itemlist+= items[i].id.substr(3)+",";
			}
			$.ajax({
			   type: "POST",
			   dataType: "json",
			   url: "usuariosDelete.php",
			   data: "items="+itemlist,
			   success: function(data){
			   	alert("Query: "+data.query+" - Total affected rows: "+data.total);
			   $("#flex1").flexReload();
			   }
			 });
			}
			} else {
				return false;
			}
        }
    else if (com=='Add')
        {

            alert('Add New Item Action');

        }
}
</script>

</head>
<div style="padding:10px;">
<form id="addform" method="post" action="usuarios.php">
<input type="hidden" name="action" value="add" />
<label for="data_field">data:</label> <input id="data_field" name="nome" />
<button type="submit">add</button>
</form>
</div>
<table id="flex1" style="display:none"></table>
<br /><br />
		<div id="previewLayer" class="jqmWindow jqDrag">
			<div id="handle">
            <input type="image" src="close.gif" class="jqmdX jqmClose" />
			</div>
			<div id="horiz_div"></div>
			<div id="previewContent">
            Please wait... <img src="busy.gif" alt="loading" />
			</div>
	<div class="jqHandle jqResize"></div>
		</div>
<a href="#" class="ex2trigger">
<br>Modal Window</a>





Return current item: Livraria Navi - Ej Project