Author Topic: Enabling of Tabs inside Check Function is Not Working.  (Read 2444 times)

bsolTeamBglr

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 41
    • View Profile
Enabling of Tabs inside Check Function is Not Working.
« on: February 06, 2018, 04:49:31 pm »
Hi Param Query Team,

I have total 8 tabs.I want to enable/disable the tabs based on checkbox.In a row after a cell is unchecked i need to enable the tabs, Inside param-query's check function if i try to use $("#tabs").tabs("enable") it is throwing error.

Uncaught Error: cannot call methods on tabs prior to initialization; attempted to call method 'enable'.
Please give me a solution regarding the above.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Enabling of Tabs inside Check Function is Not Working.
« Reply #1 on: February 06, 2018, 04:56:10 pm »
Please share a jsfiddle / plnkr.

bsolTeamBglr

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: Enabling of Tabs inside Check Function is Not Working.
« Reply #2 on: February 07, 2018, 03:22:49 pm »
Hi Param Query Team,

Below is the code snippet
      <li><a href="#tabs-2">Tab 2</a>
        </li>
        <li><a href="#tabs-3">Tab 3</a>
        </li>
    </ul>
    <div id="tabs-1">
        <div id="tabs-1_tab_main"  ></div>
    </div>
    <div id="tabs-2">
       <div id="tabs-2_tab_main"  ></div>
    </div>
    <div id="tabs-3"  ></div>
         <div id="tabs-3_tab_main"  ></div>
    </div>
</div>

 $(function(){
 var  colModel= [
 {title: "Checkbox Column ",minWidth: 150, align: "center",  dataIndx: "checkboxcolumn",  cb: { header: false, all: true, }, type: 'checkbox',editable:true,   dataType: 'bool',editor: false,resizable: false, sortable:false,},
 {title: "Column 1", minWidth: 130, align:"center", dataType: "float",dataIndx:"addlheatingDays",resizable:false,sortable: false,hidden:false},
 ]
 var data = [{}];
var dataModel = { 
             data:data,
                  recIndx: "",
                 location: "local",
                 };
   
    var toolBar='';
          var obj={
                         height: 502,
          width: 1354,
                 dataModel:dataModel,
                  colModel:colModel,
                  wrap: false,
                  hwrap: true,
                  resizable: false,
                  rowBorders: true,
                  sortable:false,
                  stripeRows : false,
                  numberCell: { show: true },
                  track: true, //to turn on the track changes.
                  flexHeight: false,
                  showBottom:false,
                  dragColumns: { enabled: false },
                  virtualX:false,
                  showTitle: false,
                  scrollModel: {
                      autoFit: true
                  },
                  collapsible: { on: false, collapsed: false },
                  selectionModel: { type: 'none', subtype:'incr',                     cbHeader:false, cbAll:false},
                  editModel: {
                      saveKey: $.ui.keyCode.ENTER
                  },
             
        beforeCheck:function( event, ui ) {
           
            },
            check:function( event, ui ) {
    if($( "#tabs-2_tab_main" ).pqGrid( "isDirty", { rowIndx: ui.rowIndx})){
    $("#tabs").tabs({ disabled: [0,1,2]});
            }else{
                    // $("#tabs").tabs("enable");// on load of grid,the                  //enable function is not working.
         //   $('#tabs').tabs('option', 'active');
        //$( "#tabs" ).tabs( "option", "disabled", [] );
       //$("#tabs").attr("disabled",false)
                  
                  $("#tabs").tabs({
                      activate: function (event, ui) {
                         $('#tabs').tabs('option', 'active').attr("href");
                             }//loading of grid working fine but enabling of other tabs is not working.
                  });
            }
            }
            }
       $("#tabs-2_tab_main").pqGrid(obj);   
             

});

Note- The requirement of my issue is in a grid i.e in one tab, i have one Check box column and non Checkbox Column.If any of the row is getting modified the other tabs should get disabled otherwise enabled.When we have changed the non checkbox column after that if we modify the checkbox the tabs enabling are not happening.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Enabling of Tabs inside Check Function is Not Working.
« Reply #3 on: February 07, 2018, 11:44:16 pm »
Could you please share jsfiddle so that I can check your code.