How to load data in jqgrid manually?
Asked Answered
A

1

3

I want to load data form combobox and textfield data to grid.

How to do it?

enter image description here

Above Image : select box data in column 1 and textbox data in column 2.

Here is my Jsp Grid code:

<s:url id="remoteurl" action="" />
        <sjg:grid caption="RECORDS"
        gridModel="dto_plot_rep" 
        width="300" height="80"
        href="%{remoteurl}"    
        id="gridtable2" 
        rownumbers="true"
        viewrecords="true"
        pager="true"    
        pagerPosition="centar"
        navigator="true"
        navigatorSearch="true"
        navigatorSearchOptions="{multipleSearch:true}"
        navigatorDelete="false"  
        navigatorEdit="false"    
        loadonce="true"         
        onCompleteTopics="cal_tot" 
        userDataOnFooter="true"
        reloadTopics="reloadPlot"
        rowNum="10" 
       >

        <sjg:gridColumn name="m_tab_p" index="m_tab_p" title="P"  width="180" align="left" search="true" searchoptions="{sopt:['eq','cn']}" sortable="true"/>
        <sjg:gridColumn name="m_tab_ce" index="m_tab_c" title="C"  width="180" align="left" search="true" searchoptions="{sopt:['eq','cn']}" sortable="true"/>

        </sjg:grid>
Assort answered 7/7, 2014 at 5:3 Comment(2)
There's an edit dialog where you can add a record.Seagrave
When I press Add button then select box and text field record add in jqgridAssort
C
1

The addRowData method lets you add rows in to your jqgrid. Docs.

Let's say you can capture the data from your form in to an array arr = [2, 4.0] You can insert the row as follows:

<button id="add" type="button">ADD</button>

<script>
$("#add").click(function(){
    arr = [2, 4.0]; //You will need to populate this array based on values of your form
    lastId = parseInt($(#gridId).getDataIDs().length) + 1;
    $("#gridId").jqGrid('addRowData',lastId, arr, "last");
  });
</script>
Conventicle answered 29/8, 2014 at 19:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.