EasyUI Forum
September 13, 2025, 07:39:14 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Editing subgrid row...  (Read 9279 times)
wexwell
Newbie
*
Posts: 8


View Profile Email
« on: September 02, 2014, 12:57:28 PM »

OK- I have been beating my head against this since last Friday, I figure it is finally time to post for help. I think I have my code fairly settled, and I think things should work.

I have a grid where I edit the row, add rows, and then I expand the rows loading a subgrid (editable edatagrid). I want to simply edit and cancel the editable subgrid. However also want to take the ID column that I pass to the server page for updating from the parent row (api).

Editing and adding new rows is working, opening the fields I want as editable in an editable grid in the sub row is working. However getting the sub grid to cancel edit, save, and use iconCls will not work (iconCls code removed at the moment for the subgrid). I have not included all the code, just what is relevant to the question here so there are some other calls with missing javascript. If anybody would like that code just holler, and I will include it.

Code:
<!doctype html>
<html>
<head>
    <!--jquery start datagrid components-->
<link rel="stylesheet" type="text/css" href="/Includes/jquery/themes/gray/easyui.css">
<link rel="stylesheet" type="text/css" href="/Includes/jquery/themes/icon.css">
<link rel="stylesheet" type="text/css" href="/Includes/jquery/demo/demo.css">
<script type="text/javascript" src="/Includes/jquery/jquery.min.js"></script>
<script type="text/javascript" src="/Includes/jquery/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/Includes/jquery/plugins/datagrid-detailview.js"></script>
<script type="text/javascript" src="/Includes/jquery/plugins/jquery.edatagrid.js"></script>   
    <!--jquery end datagrid components-->
</head>
<body>
    <section class="grid">     
      <table id="wells" class="easyui-datagrid" title=" " style="width:100%;height:500px"
        pagination="true" idField="api" fitColumns="true" url="getinfo.php"
        collapsible="true" singleSelect="true" toolbar="#tb" resizeHandle="both"
            autoRowHeight="true" nowrap="false" rownumbers="true" pageList="[10,25,50,100,5000]">
            <thead>
                <tr>
                    <th data-options="field:'well_name', width:48" sortable="true">Name</th>
                    <th data-options="field:'well_num',width:18" sortable="true">Num</th>
                    <th data-options="field:'field',width:48" sortable="true">Field</th>
                    <th data-options="field:'pad',width:36" sortable="true">Pad</th>
                    <th data-options="field:'api',width:32" sortable="true">API</th>
                    <th data-options="field:'legal_description',width:46" sortable="true">Legal</th>
                    <th data-options="field:'county_state',width:40" sortable="true">County, State</th>
                    <th data-options="field:'lease',width:33" sortable="true">Lease</th>
                    <th data-options="field:'unit_ca_pa',width:57" sortable="true">Unit CA PA</th>
                    <th data-options="field:'status',width:27">Status</th>
                  <th data-options="field:'status_date',width:22">Updated</th>
                    <th data-options="field:'wildlife_stips',width:75">Wildlife Stips</th>
                    <th data-options="field:'notes',width:75">Notes</th>                               
                </tr>
            </thead>
      </table>
  <div id="tb" style="padding:3px"><span>Field:</span>
          <input id="field" style="line-height:22px;border:1px solid #ccc">
            <span>Pad:</span>
            <input id="pad" style="line-height:22px;border:1px solid #ccc">
            <span>API:</span>
            <input id="api" style="line-height:22px;border:1px solid #ccc">
            <a href="#" class="easyui-linkbutton" plain="true" onclick="doSearch()">Search</a>
            <a href="#" class="easyui-linkbutton" plain="true" onclick="doReset()">Reset</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newWell()">New Well</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editWell()">Edit Well</a>
      </div>
<script type="text/javascript">
$('#wells').datagrid(
{
view: detailview,
detailFormatter:function(index,row)
{ return '<div style="padding:2px"><table class="ddv"></table></div>'; },
onExpandRow: function(index,row)
{
var ddv = $(this).datagrid('getRowDetail',index).find('table.ddv');
ddv.edatagrid(
{
url:'geteditexpand.php?api='+row.api,
saveUrl:'updateeditwell.php?api='+row.api,
fitColumns:true,
singleSelect:true,
rownumbers:true,
loadMsg:'',
height:'auto',
columns:[[
{field:'location',title:'Location'},
{field:'NorthSouth',title:'N+S-',editor:'text'},
{field:'EastWest',title:'E+W-',editor:'text'},
{field:'latitude',title:'Latitude',editor:'text'},
{field:'longitude',title:'Longitude',editor:'text'},
{field:'lot',title:'Lot',editor:'text'},
{field:'tract',title:'Tract',editor:'text'},
{field: 'action', title: 'Action',
formatter:function(value,row,index)
{
var s = '<a href="#" onclick="javascript:$(#wells).edatagrid(saveRow)">Save</a> ';
var c = '<a href="#" onclick="javascript:$(#wells).edatagrid(cancelRow)">Cancel</a>';
return s+c;
}
}
]],
onResize:function()
{ $('#wells').edatagrid('fixDetailRowHeight',index); },
onLoadSuccess:function()
{
setTimeout(function(){
$('#wells').edatagrid('fixDetailRowHeight',index);
},0);
}
});
$('#wells').datagrid('fixDetailRowHeight',index);
}
});
</script>

  </section>
</div>
</body>
</html>
Logged
wexwell
Newbie
*
Posts: 8


View Profile Email
« Reply #1 on: September 03, 2014, 12:15:24 PM »

I have been working on this quite a big, I'm very convinced the problem is that nothing is recognizing the subgrid as a 'named grid. I am not real great with javascript or jquery, and I am still searching for code samples that will help me clarify this part of the code. I think this will solve my problem. If anyone has suggestions please do not hesitate to post them.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!