Author Topic: Add new Row in Popup Tab  (Read 2801 times)

bsolteam

  • Pro Deluxe
  • Full Member
  • *
  • Posts: 107
    • View Profile
Add new Row in Popup Tab
« on: September 19, 2014, 07:18:32 pm »
add : function() {
            
            var $grid = $("#off_hire_tab");
            var data = $grid.pqGrid('option', 'dataModel.data');               
            
            var rowIndx = data.length;            
            
                  if(data[0].isAdded == null)
                           {               
                           var rowData = {
                                 from_Date:'<div class="input-append" id="datepicker'+rowIndx+'" data-date="" data-date-format="dd/MM/yyyy hh:mm"><input type="text" value=" " id="fromDate'+rowIndx+'" style="width:160px;height:14px;width:140px;size:12px;font-family:Arial" readonly><span class="input-append add-on"><i data-date-icon="icon-calendar" data-time-icon="icon-time" class="icon-calendar"></i></span></div>',
                                 to_Date:'<div class="input-append" id="datepick'+rowIndx+'" data-date="" data-date-format="dd/MM/yyyy hh:mm"><input type="text" value=" " id="toDate'+rowIndx+'" style="width:160px;height:14px;width:140px;size:12px;font-family:Arial" readonly><span class="input-append add-on"><i data-date-icon="icon-calendar" data-time-icon="icon-time" class="icon-calendar"></i></span></div>',   
                                 offhire_reason:"",
                           }
                           $grid.pqGrid("addRow", {rowData : rowData});
                           data[0].isAdded = "yes";
                              }
            
                   else{
                        $.jGrowl("New row already Exists", { sticky: false });
                         $.jGrowl.defaults.pool = 1;
                           exit;
                     }
         
         }

This is my add function Query. Here if datas are there means i can add a new row. But if there is no row on the tab means i can't able to add. will you please help me how can i add a new row if there is no data also.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6298
    • View Profile
Re: Add new Row in Popup Tab
« Reply #1 on: September 22, 2014, 09:22:19 am »
addRow method of paramquery grid API works fine even when there is no data in the grid.

Please check these urls in this order.

http://paramquery.com/pro/products/clear would clear all the records from the grid.

http://paramquery.com/pro/demos/editing