On Thu, Mar 5, 2009 at 9:41 PM, MorningZ <morni...@gmail.com> wrote:

>
> Can you post (preferably on http://paste.pocoo.org/) what:
> 1) What both tables look like? (as previously mentioned, your screen
> shot only shows one table, that doesn't help)
> 2) how you are assigning the variable "$slave_table"
>
> Seeing both those will help solve the issue
>
> ok, for example, here is my html code snippet:
<div id='table_container">
    <table id="frm_table">
        <thead>
            <tr>
                <th id="col_1" class='ColumnHeader">ID</th>
                <th id="col_2" class='ColumnHeader">Language</th>
                <th id="col_3" class='ColumnHeader">Dexcription</th>
            </tr>
        </thead>
    </table>
</div>
<div id="data_framework">
    <table id="data_grid">
        <tbody id="tabbody">
            <tr>
                <td>1</td>
                <td>ENG</td>
                <td>English</td>
            </tr>
            <tr>
                <td>2</td>
                <td>FRE</td>
                <td>French</td>
            </tr>
        </tbody>
    </table>
</div>

in my jQuery code if i use :
$slave_table.find("tbody").each(function(i){..});
it works but if i add the tr as following:
$slave_table.find("tbody tr").each(function(i){..});
or
$slave_table.find("tbody").find("tr").each(function(i){..});
it does not work

those code lines are in a function defined as following:
function Grid_Colunns_Resize($master_table, $slave_table)
{
 var MaxWidths = {};
 var $th;

 // both table exist and are only found once into document
 if($master_table.length == 1 && $slave_table.length == 1)
 {
  $master_table.find("thead tr").find("th.ColumnHeader").each(function(i)
  {
    if (MaxWidths[i] == null || ($(this).width() > MaxWidths[i]))
    {
       MaxWidths[i] = $(this).width() || 0;
    }
  }
});

$slave_table.find("tbody tr").each(function(i)
{
 alert("tbody tr");
});

i call this function as following:
Grid_Colunns_Resize($("#frm_table"), $("#data_grid"));

is it clearer ?

A.

Reply via email to