Author Topic: jQueryUI Tabs  (Read 3337 times)

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
jQueryUI Tabs
« on: December 05, 2019, 09:23:25 pm »
Hi

When clicking on "Tab 2" it does not render correctly...any idea why?

Code: [Select]
<script>

  $(function () {   

    $("#tabs").tabs();
   
    $("#grid1").pqGrid({
  dataModel:{data:[{a:"b"}]}
    })

    $("#grid2").pqGrid({
  dataModel:{data:[{c:"d"}]}
  })
});

</script>

<div id="tabs">
  <ul>
    <li><a href="#grid1">Tab 1</a></li>
    <li><a href="#grid2">Tab 2</a></li>
  </ul>
 
<div id="grid1" style="margin:auto;"></div>
<div id="grid2" style="margin:auto;"></div>

</div>

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: jQueryUI Tabs
« Reply #1 on: December 06, 2019, 01:43:04 am »
Solved.

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: jQueryUI Tabs
« Reply #2 on: December 06, 2019, 04:30:20 am »
Still having problems with tabs.
When using remote data with tabs it seems it won't assign data to grid.

Grid code works fine outside tabs but when divs are nested (tabs) it wont assign data to grid. I get json string returned fine...but no rows are displayed.

Any idea?



paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6307
    • View Profile
Re: jQueryUI Tabs
« Reply #3 on: December 06, 2019, 04:05:19 pm »
Grid in a tab needs to be refreshed whenever the tab is activated ( activate event ).

Please check this demo: https://paramquery.com/pro/demos/grid_in_tabs

https://paramquery.com/pro/demos/tabs
« Last Edit: September 07, 2020, 09:22:18 am by paramvir »

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: jQueryUI Tabs
« Reply #4 on: December 07, 2019, 07:00:33 pm »
Thanks, works fine.

When using multiple grids with tabs I would like to define each grid in separate .js files and then load each grid in main file...what would be a good way to do this?
Tried using
Code: [Select]
$.getScript("test.js")...but function is undefined when called in main function...although it exists after load?