Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
230
JavaScript adding new row doesn't work for UltraWebGrid within an UltraWebPanel
posted

 Hi,

I am not sure what I am missing. I have an UltraWebGrid in a collapsible panel. But the javascript fails to add row.

If I comment the collapsible panel then the add row works fine using the javascript. How can I achieve this with the grid in a collapsible panel? Code sample that I am using is given below.

 Any help will be appreciated.

<script type="text/javascript">
  function addRow()
  {   
            var row = igtbl_addNew("gridTrane", 0);
            row.getCell(0).setValue(0);
            //row.getCell(1).setValue(0);
            row.getCell(1).setValue("None");
            row.getCell(2).setValue("-");
            row.getCell(3).setValue(0.00);
            row.getCell(4).setValue("EUR");           
            //row.getCell(5).setValue(new Date());    
  }
</script> 

<table>
 <tr>
  <td align="left">               
   <igmisc:WebPanel ID="pnlCompetitor" runat="server" Width="100%" Expanded="True" Visible="true">
    <Header Text="Competitor Information:" TextAlignment="Left" CollapsedAppearance-Styles-Font-Bold="true">
     <ExpandedAppearance>
      <Styles Font-Bold="True">
      </Styles>
     </ExpandedAppearance>
     <CollapsedAppearance>
      <Styles Font-Bold="True">
      </Styles>
     </CollapsedAppearance>
    </Header>
    <Template>                  
     <table class="Normal" align="center" width="60%">
      <tr>
       <td align="center">
        <input id="btnCust" onclick="addRow()" type="button" value="Add Row"/>
       </td>
      </tr>
      <tr>
       <td align="center">
        <igmisc:WebAsyncRefreshPanel ID="WebAsyncRefreshPanel3" runat="server">                                                  
        <igtbl:UltraWebGrid ID="gridTrane" runat="server" OnInitializeLayout="gridTrane_InitializeLayout"
         Width="100%" EnableAppStyling="True">
         <Bands>
          <igtbl:UltraGridBand>
           <AddNewRow View="NotSet" Visible="NotSet">
           </AddNewRow>
          </igtbl:UltraGridBand>
         </Bands>
         <DisplayLayout AllowColSizingDefault="Free" AllowDeleteDefault="Yes" AllowSortingDefault="OnClient"
          AllowUpdateDefault="Yes" BorderCollapseDefault="Separate" CellClickActionDefault="Edit"
          HeaderClickActionDefault="SortMulti" Name="gridTrane" OptimizeCSSClassNamesOutput="False"
          Pager-AllowPaging="false" RowHeightDefault="20px" RowSelectorsDefault="No" ScrollBar="Auto"
          ScrollBarView="Horizontal" SelectTypeRowDefault="Extended" StationaryMargins="Header"
          StationaryMarginsOutlookGroupBy="True" TableLayout="Fixed" UseFixedHeaders="true"
          AllowColumnMovingDefault="OnServer">                           
         </DisplayLayout>
        </igtbl:UltraWebGrid>
        </igmisc:WebAsyncRefreshPanel>
       </td>
      </tr>
     </table>
    </Template>
   </igmisc:WebPanel>               
  </td>
 </tr>
</table>

  • 49378
    posted

    Hi Anish,

    It has been a while since your post, however in case you still need assistance I would be glad to help.

    Your row addition implementation is most likely not working because the grid is not found when you are searching for it in your javascript method. By default the ClientIDMode of the WebDataGrid is set to inherit and therefore in your case the id would not be gridTrane. Setting the ClientIDMode of your grid to static should resolve the matter.

    Please contact me if you need further assistance.

    Best Regards,

    Petar Ivanov
    Developer Support Engineer
    Infragistics, Inc.
    http://es.infragistics.com/support