Login   Register  
PHP Classes
elePHPant
Icontem

File: datamanage/js/search_js.js

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Mathew  >  Data Manager  >  datamanage/js/search_js.js  >  Download  
File: datamanage/js/search_js.js
Role: Auxiliary data
Content type: text/plain
Description: js
Class: Data Manager
Retrieve and store MySQL records using Web forms
Author: By
Last change:
Date: 2013-11-06 01:43
Size: 3,421 bytes
 

Contents

Class file image Download
$(document).ready(function() {
    $('#btn-add').click(function(){
        $('#select-from option:selected').each( function() {
                $('#select-to').append("<option value='"+$(this).val()+"'>"+$(this).text()+"</option>");
            $(this).remove();
        });
    });
    $('#btn-remove').click(function(){
        $('#select-to option:selected').each( function() {
            $('#select-from').append("<option value='"+$(this).val()+"'>"+$(this).text()+"</option>");
            $(this).remove();
        });
    });
    $('#btn-up').bind('click', function() {
        $('#select-to option:selected').each( function() {
            var newPos = $('#select-to option').index(this) - 1;
            if (newPos > -1) {
                $('#select-to option').eq(newPos).before("<option value='"+$(this).val()+"' selected='selected'>"+$(this).text()+"</option>");
                $(this).remove();
            }
        });
    });
	
    $('#btn-down').bind('click', function() {
        var countOptions = $('#select-to option').size();
		var i =	$('#select-to option:selected').length ;
		var j = 0;
        $('#select-to option:selected').each( function() {
			var newPos =  $('#select-to option').index(this) + i;
			if(newPos == countOptions && j == 0)
			{
				j++;
				newPos = newPos-j;
			}
			else
			{
				i--;
			}
			if (newPos < countOptions) {
                $('#select-to option').eq(newPos).after("<option value='"+$(this).val()+"' selected='selected'>"+$(this).text()+"</option>");
                $(this).remove();
            }
        });
    });
	
	
	
	
	$('#btn-full-top').bind('click', function() {
		var i = 0;
        $('#select-to option:selected').each( function() {
            var newPos = i;
			i++;
			if (newPos > -1) {
                $('#select-to option').eq(newPos).before("<option value='"+$(this).val()+"' selected='selected'>"+$(this).text()+"</option>");
                $(this).remove();
            }
        });
    });
	
	
	$('#btn-full-btm').bind('click', function() {
		var countOptions = $('#select-to option').size();
		var sel = $('#select-to option:selected').length  ;
		
		for(x=0; x<=3 ; x++)
		{	
			var i = countOptions-sel;
			$('#select-to option:selected').each( function() {
				var newPos = i;
				i++;
				if (newPos < countOptions) {
					$('#select-to option').eq(newPos).after("<option value='"+$(this).val()+"' selected='selected'>"+$(this).text()+"</option>");
					$(this).remove();
				}
			});
		}
    });
	

});

function selectAll(selectBox,selectAll) {
    // have we been passed an ID
    if (typeof selectBox == "string") {
        selectBox = document.getElementById(selectBox);
    }

    // is the select box a multiple select box?
    if (selectBox.type == "select-multiple") {
        for (var i = 0; i < selectBox.options.length; i++) {
            selectBox.options[i].selected = selectAll;
        }
    }
}
function callChk()
{
	selectAll(document.getElementById('select-to'),true);
	return false;
}
function pagingSubmit(rset)
{
	alert('aaaa');
	document.paging.Result_Set.value = rset;
	document.paging.submit();
}
function callBtwn(str,num)
{
	var divId = "sDiv"+num;
	document.getElementById(divId).style.display = 'none';
	if(str == "btw")
	{
		document.getElementById(divId).style.display = 'block';
	}
}