Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with table in table #57

Open
sdong2711 opened this issue Jun 12, 2013 · 1 comment
Open

Problem with table in table #57

sdong2711 opened this issue Jun 12, 2013 · 1 comment

Comments

@sdong2711
Copy link

Hello,
I have a problem with the function tableToArray(), if i have a table in table.
There are some unnecessary rows added. Have someone a workarround?
See Example:

[code]

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/themes/base/jquery-ui.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>    
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>
<link rel="stylesheet" href="pqgrid.min.css" />
<script src="pqgrid.min.js"></script>
<link rel="stylesheet" href="themes/office/pqgrid.css" />
<script> $(function () { var tbl = $("table.fortune500"); var obj = $.paramquery.tableToArray(tbl); var newObj = { width: 609, height: 530, flexHeight:true, numberCell: false, freezeCols: 2, columnBorders: true, rowBorders:true, editable:false, selectionModel: false, topVisible: false, bottomVisible: false, roundCorners:false}; newObj.dataModel = { data: obj.data}; newObj.colModel = obj.colModel; $("#grid_array").pqGrid(newObj); }); </script>
        <tr class="rowcolor2">
            <td class="rank">1</td>
            <td class="company">Exxon Mobil</td>
            <td class="revenue">339,938.0</td>
            <td class="datacell">36,130.0</td>
            <td class="withtab">
                <table cellspacing="0" cellpadding="0" border="1">
                    <tr>
                        <td>in1</td>
                        <td>Icon</td>
                    </tr>
                </table>
            </td>
        </tr>


        <tr class="rowcolor1" id="Tr1">
            <td class="rank">2</td>
            <td class="company">Wal-Mart Stores</td>
            <td class="revenue">315,654.0</td>
            <td class="datacell">11,231.0</td>
            <td class="withtab"></td>
        </tr>                                                                     

        <tr class="rowcolor2" id="Tr2">
            <td class="rank">3</td>
            <td class="company">Royal Dutch Shell</td>
            <td class="revenue">306,731.0</td>
            <td class="datacell">25,311.0</td>
            <td class="withtab"></td>
        </tr>

        <tr class="rowcolor1" id="Tr3">
            <td class="rank">4</td>
            <td class="company">BP</td>
            <td class="revenue">267,600.0</td>
            <td class="datacell">22,341.0</td>
            <td class="withtab">
                <table cellspacing="0" cellpadding="0" border="1">
                    <tr>
                        <td>in1</td>
                        <td>Icon</td>
                    </tr>
                    <tr>
                        <td>in2</td>
                        <td>Icon2</td>
                    </tr>
                </table>
            </td>
        </tr>
        <!-- repeating rows end -->
    </tbody></table>
[/code]
Rank Company Revenues ($ millions) Profits ($ millions) Within-Table
@sdong2711
Copy link
Author

temp workarround for me:
i definied a attribute "class" with the String "pgignore"(or other text) to the TRs, which i dont want to added(they are already added before).
Then i added code to the function:

$.paramquery.tableToArray=function(tbl){
........
})
$tbl.find("tr").each(function(i,tr) {
if(i==0)return;

            var $tr=$(tr);

                            // BEGIN ADDED
            var attText = $tr.attr('class');
                        if (attText != null ) {
                    if (attText.indexOf("pgignore") == 0) {
                    return;
                    }
                    }
                            // END ADDED 

            .............
        })
        return {data:data,colModel:colModel};
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant