JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 21st, 2013, 07:05 AM
vilim vilim is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 1 vilim User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 26 sec
Reputation Power: 0
Javascript search field + check box

hy guys,
I'm relatively new to javascript so I would need some help if you could.
I'm creating some web aplication for one company storage management and I made it to log everything that anyone does on the page, so I have 7 tipes of logs (sales-prodaja, article entry- unos artikala, article editing-izmjena artikala, article deleting-brisanje artikala, worker entry- unos radnika, worker editing-izmjena radnika, worker deleting-brisanje radnika). I made a table where all the logs are shown, and above the logs are check boxes to check wich log would the boss want to see, there is a filter field to if he would like to search for something specific. The check box alone works fine and the filter field too, but when a hide some records with checkbox (for example, I uncech sales checkbox and then its not shown), and then enter a word that I have in sales record the records showes. So waht I would like is when some logs are hidden with checkbox option, and something is entered in filter field I would like to filter just shown logs not hidden too.

picture:
http://img204.imageshack.us/img204/6722/picwcn.jpg

here is the code:
check box:
Code:
function showHideProdaja()
        {
            if(document.getElementById('prodaja').checked)
            {
				$("table tr[id='log']").show();
            }
            else
            {
				$("table tr[id='log']").hide();
            }
        }


function showHideUnosArtikla()
        {
            if(document.getElementById('unosArtikla').checked)
            {
				$("table tr[id='logUnosArtikla']").show();
            }
            else
            {
				$("table tr[id='logUnosArtikla']").hide();
            }
        }


function showHideEditArtikala()
        {
            if(document.getElementById('izmjenaArtikala').checked)
            {
				$("table tr[id='logEditArtikala']").show();
            }
            else
            {
				$("table tr[id='logEditArtikala']").hide();
            }
        }


function showHideBrisanjeArtikala()
        {
            if(document.getElementById('brisanjeArtikala').checked)
            {
				$("table tr[id='logBrisanjeArtikala']").show();
            }
            else
            {
				$("table tr[id='logBrisanjeArtikala']").hide();
            }
        }
		

function showHideUnosRadnika()
        {
            if(document.getElementById('unosRadnika').checked)
            {
				$("table tr[id='logUnosRadnika']").show();
            }
            else
            {
				$("table tr[id='logUnosRadnika']").hide();
            }
        }


function showHideEditRadnika()
        {
            if(document.getElementById('izmjenaRadnika').checked)
            {
                $("table tr[id='logEditRadnika']").show();
            }
            else
            {
				$("table tr[id='logEditRadnika']").hide();
            }
        }


function showHideBrisanjeRadnika()
        {
            if(document.getElementById('brisanjeRadnika').checked)
            {
				$("table tr[id='logBrisanjeRadnika']").show();
            }
            else
            {
				$("table tr[id='logBrisanjeRadnika']").hide();
            }
        }



filter field:

Code:
// When document is ready: this gets fired before body onload :)
$(document).ready(function(){
	// Write on keyup event of keyword input element
	$("#kwd_search").keyup(function(){
		// When value of the input is not blank
		if( $(this).val() != "")
		{
			// Show only matching TR, hide rest of them
			$("#my-table tbody>tr").hide();
			$("#my-table td:contains-ci('" + $(this).val() + "')").parent("tr").show();
		}
		else
		{
			// When there is no input or clean again, show everything back
			$("#my-table tbody>tr").show();
		}
	});
});
// jQuery expression for case-insensitive filter
$.extend($.expr[":"], 
{
    "contains-ci": function(elem, i, match, array) 
	{
		return (elem.textContent || elem.innerText || $(elem).text() || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
	}
});



i tried to do

Code:
// When document is ready: this gets fired before body onload :)
$(document).ready(function(){
	// Write on keyup event of keyword input element
	$("#kwd_search").keyup(function(){
		// When value of the input is not blank
		if( $(this).val() != "")
		{
			// Show only matching TR, hide rest of them
			$("#my-table tbody>tr").hide();
			if(document.getElementById('someLogID').style.display!='none'){//NEW LINE
			$("#my-table td:contains-ci('" + $(this).val() + "')").parent("tr").show();
			}
		}
		else
		{
			// When there is no input or clean again, show everything back
			$("#my-table tbody>tr").show();
		}
	});
});
// jQuery expression for case-insensitive filter
$.extend($.expr[":"], 
{
    "contains-ci": function(elem, i, match, array) 
	{
		return (elem.textContent || elem.innerText || $(elem).text() || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
	}
});


and other similar things but when I try to enter anaything in the filter then nothing shows soo....
If anyone coluld please help me I would apriciate it.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Javascript search field + check box

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap