[jQuery] Re: one check box to select entire group

2009-03-26 Thread Andy H

Here's the html for you.


table
tr
th/th
thTitle/th
thinput type=checkbox name=chk_cat1 id=chk_cat1 //
th
thinput type=checkbox name=chk_cat2 id=chk_cat2 //
th
/tr
tr
tdinput type=checkbox name=chk_row1 id=chk_row1 //
td
tdDescription 1/td
tdinput type=checkbox name=chk_cat1_row1
id=chk_cat1_row1 //td
tdinput type=checkbox name=chk_cat2_row1
id=chk_cat2_row1 //td
/tr
tr
tdinput type=checkbox name=chk_row2 id=chk_row2 //
td
tdDescription 2/td
tdinput type=checkbox name=chk_cat1_row2
id=chk_cat1_row2 //td
tdinput type=checkbox name=chk_cat2_row2
id=chk_cat2_row2 //td
/tr
/table




I think what I'm going to do is change the attributes for the
checkboxes, so it will make it easier to find the header related
checkboxes and row related items.  So, I'll be formatting the check
boxes like this:

input type=checkbox name=chk_cat1_row1 id=chk_cat1_row1
headerid=chk_cat1 rowid=row1 /

Now I don't have to parse any id's out and jQuery seems to work with
this.



Thanks!







On Mar 25, 5:41 pm, MorningZ morni...@gmail.com wrote:
 How about just showing the HTML instead of hard to follow
 explainations

 It's still not clear what the header column is  is it text? is
 there a checkbox?  what has the id cat1?

 On Mar 25, 5:22 pm, Andy H adharb...@gmail.com wrote:



  That is close, the item section will be different for each check box.
  The table will have three columns that will be populated with check
  boxes only.  The header section in the table will have a global select
  for each column.   So  if there is a row that has the following

  chk_categoryID_itemID   each row will share the same
  itemID and each column will share the same category id.

  header1 = cat1... header2 = cat2.
  row1 = item1 row2 = item2

  so we have two rows with two columns.  We'll have four checkboxes that
  will look like this.

  ckb_cat1_item1        ckb_cat2_item1
  ckb_cat1_item2        ckb_cat2_item2

  So, if I select the header for category 1, I need to be able to select
  ckb_cat1_item1  ckb_cat1_item2.

  Hopefully that makes more sense.

  Thanks!

  On Mar 25, 11:37 am, MorningZ morni...@gmail.com wrote:

   Your description of your HTML isn't very clear, but none the less this
   could work:

   $(selector for header checkboxes).click(function() {
         var chk = this;
         $(input[id^=' + chk.id + _item']).each(function()
   { this.checked = chk.checked; });

   })

   On Mar 25, 12:12 pm, Andy adharb...@gmail.com wrote:

Hey guys,

I have a table where the header has check boxes so if you click on
that, it will select all of the other checkboxes in that row.   The
issue I have, it's not a select all checkboxes, but ones that have a
specific naming convention.   Example.  If my header is named
ckb_category1 I need to be able to find all checkboxes that are in
that column that have naming like ckb_category1_item1.  Then each row
following would have a different item id, but keep the category1 the
same.   Is there a pattern I can use that would work for this?

Thanks!- Hide quoted text -

   - Show quoted text -- Hide quoted text -

 - Show quoted text -


[jQuery] Re: one check box to select entire group

2009-03-25 Thread MorningZ

Your description of your HTML isn't very clear, but none the less this
could work:

$(selector for header checkboxes).click(function() {
  var chk = this;
  $(input[id^=' + chk.id + _item']).each(function()
{ this.checked = chk.checked; });
})

On Mar 25, 12:12 pm, Andy adharb...@gmail.com wrote:
 Hey guys,

 I have a table where the header has check boxes so if you click on
 that, it will select all of the other checkboxes in that row.   The
 issue I have, it's not a select all checkboxes, but ones that have a
 specific naming convention.   Example.  If my header is named
 ckb_category1 I need to be able to find all checkboxes that are in
 that column that have naming like ckb_category1_item1.  Then each row
 following would have a different item id, but keep the category1 the
 same.   Is there a pattern I can use that would work for this?

 Thanks!


[jQuery] Re: one check box to select entire group

2009-03-25 Thread Andy H

That is close, the item section will be different for each check box.
The table will have three columns that will be populated with check
boxes only.  The header section in the table will have a global select
for each column.   So  if there is a row that has the following


chk_categoryID_itemID   each row will share the same
itemID and each column will share the same category id.


header1 = cat1... header2 = cat2.
row1 = item1 row2 = item2


so we have two rows with two columns.  We'll have four checkboxes that
will look like this.

ckb_cat1_item1ckb_cat2_item1
ckb_cat1_item2ckb_cat2_item2


So, if I select the header for category 1, I need to be able to select
ckb_cat1_item1  ckb_cat1_item2.



Hopefully that makes more sense.


Thanks!







On Mar 25, 11:37 am, MorningZ morni...@gmail.com wrote:
 Your description of your HTML isn't very clear, but none the less this
 could work:

 $(selector for header checkboxes).click(function() {
       var chk = this;
       $(input[id^=' + chk.id + _item']).each(function()
 { this.checked = chk.checked; });

 })

 On Mar 25, 12:12 pm, Andy adharb...@gmail.com wrote:



  Hey guys,

  I have a table where the header has check boxes so if you click on
  that, it will select all of the other checkboxes in that row.   The
  issue I have, it's not a select all checkboxes, but ones that have a
  specific naming convention.   Example.  If my header is named
  ckb_category1 I need to be able to find all checkboxes that are in
  that column that have naming like ckb_category1_item1.  Then each row
  following would have a different item id, but keep the category1 the
  same.   Is there a pattern I can use that would work for this?

  Thanks!- Hide quoted text -

 - Show quoted text -


[jQuery] Re: one check box to select entire group

2009-03-25 Thread MorningZ

How about just showing the HTML instead of hard to follow
explainations

It's still not clear what the header column is  is it text? is
there a checkbox?  what has the id cat1?

On Mar 25, 5:22 pm, Andy H adharb...@gmail.com wrote:
 That is close, the item section will be different for each check box.
 The table will have three columns that will be populated with check
 boxes only.  The header section in the table will have a global select
 for each column.   So  if there is a row that has the following

 chk_categoryID_itemID   each row will share the same
 itemID and each column will share the same category id.

 header1 = cat1... header2 = cat2.
 row1 = item1 row2 = item2

 so we have two rows with two columns.  We'll have four checkboxes that
 will look like this.

 ckb_cat1_item1        ckb_cat2_item1
 ckb_cat1_item2        ckb_cat2_item2

 So, if I select the header for category 1, I need to be able to select
 ckb_cat1_item1  ckb_cat1_item2.

 Hopefully that makes more sense.

 Thanks!

 On Mar 25, 11:37 am, MorningZ morni...@gmail.com wrote:

  Your description of your HTML isn't very clear, but none the less this
  could work:

  $(selector for header checkboxes).click(function() {
        var chk = this;
        $(input[id^=' + chk.id + _item']).each(function()
  { this.checked = chk.checked; });

  })

  On Mar 25, 12:12 pm, Andy adharb...@gmail.com wrote:

   Hey guys,

   I have a table where the header has check boxes so if you click on
   that, it will select all of the other checkboxes in that row.   The
   issue I have, it's not a select all checkboxes, but ones that have a
   specific naming convention.   Example.  If my header is named
   ckb_category1 I need to be able to find all checkboxes that are in
   that column that have naming like ckb_category1_item1.  Then each row
   following would have a different item id, but keep the category1 the
   same.   Is there a pattern I can use that would work for this?

   Thanks!- Hide quoted text -

  - Show quoted text -