jQWidgets Forums
jQuery UI Widgets › Forums › Dialogs and Notifications › Window › weird error
Tagged: jqwindow
This topic contains 1 reply, has 2 voices, and was last updated by Peter Stoev 10 years, 5 months ago.
Viewing 2 posts - 1 through 2 (of 2 total)
-
Authorweird error Posts
-
Hi,
I got the following error:
TypeError: undefined is not an object (evaluating ‘$(“#dataTable”).offset().left’)
This is the code:
<script type="text/javascript"> $(document).ready(function () { var url = "json_users.php"; // prepare the data var source = { dataType: "json", dataFields: [ { name: 'ID', type: 'int' }, { name: 'Name', type: 'string' }, { name: 'Name2', type: 'string' }, { name: 'UserLevel', type: 'int' }, { name: 'Password', type: 'string' } ], id: 'id', url: url }; var dataAdapter = new $.jqx.dataAdapter(source); $("#dataTable").jqxDataTable( { width: 850, pageable: true, editable: false, pagerButtonsCount: 10, source: dataAdapter, columnsResize: true, columns: [ { text: 'ID', dataField: 'ID', width: 50 }, { text: 'Name', dataField: 'Name', width: 300 }, { text: 'Name2', dataField: 'Name2', width: 180 }, { text: 'User Level', dataField: 'UserLevel', width: 120 ,editable: false}, { text: 'Password', dataField: 'Password', editable:false } ] }); }); $("#dialog").jqxWindow({ resizable: false, isModal: true, position: { left: $("#dataTable").offset().left + 300, top: $("#dataTable").offset().top + 35 }, width: 400, height: 300, autoOpen: false }); $("#dialog").css('visibility', 'visible'); $("#dialog").on('close', function () { // enable jqxDataTable. $("#dataTable").jqxDataTable({ disabled: false }); }); $("#dataTable").on('rowDoubleClick', function (event) { $("#dialog").jqxWindow('open'); }); </script> </head> <body class='default'> <div id="dataTable"></div> <div style="visibility: hidden;" id="dialog"> <div>Edit Dialog</div> <div style="overflow: hidden;"> <table style="table-layout: fixed; border-style: none;"> <tr> <td align="right">Код: </td> <td align="left"> <input id="itemCode" type="text"/> </td> </tr> <tr> <td align="right">Описание: </td> <td align="left"> <input id="itemName" type="text"/> </td> </tr> <tr> <td align="right">Дост. цена: </td> <td align="left"> <input id="itemPriceIn" type="text"/> </td> </tr> <tr> <td align="right">Цена дребно:</td> <td align="left"> <input id="itemPriceOut2" type="text"/> </td> </tr> <tr> <td align="right">Цена едро:</td> <td align="left"> <input id="itemPriceOut1" type="text"/> </td> </tr> <tr> <td align="right">Ценова гр. 1:</td> <td align="left"> <input id="itemPriceOut3" type="text"/> </td> </tr> <tr> <td align="right">Ценова гр. 2:</td> <td align="left"> <input id="itemPriceOut4" type="text"/> </td> </tr> <tr> <td align="right">Ценова гр. 3:</td> <td align="left"> <input id="itemPriceOut5" type="text"/> </td> </tr> <tr> <td colspan="2" align="right"> <br /> <button id="saveButton">Запази</button> <button style="margin-left: 5px;" id="cancelButton">Откажи</button></td> </tr> </table> </div> </div> </body> </html>
Hello cpuin,
Not all of your code is within document.ready. It’s quite possible jQuery to be not yet loaded when you try to call its offset method.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.