EasyUI Forum
June 22, 2024, 03:28:35 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: onLoadSuccess Expand First Row  (Read 12668 times)
wexwell
Newbie
*
Posts: 8


View Profile Email
« on: August 20, 2014, 09:08:25 AM »



I have an application where I am loading a single row in a grid, and expanding the row to show additional details. I have been unable to find any solutions for this. It seems like I should be able to tie something into the event onLoadSuccess. Below is my code for the expanded row. (furthest on bottom).

I tried adding the following code (both rows 0 and 1), but the code simply made it so the expand rows feature was completely disabled (I have tried other code options, not many, but did not take notes on what they were).

Code:
onLoadSuccess: function()
{ $('#wells').datagrid('expandRow', 0); }

Expand row code listed below;

Code:
				<script type="text/javascript">
$('#wells').datagrid(
{
view: detailview,
detailFormatter:function(index,row)
{return '<div class="ddv" style="padding:5px 0"></div>';},
onExpandRow: function(index,row)
{
var ddv = $(this).datagrid('getRowDetail',index).find('div.ddv');
ddv.panel(
{
border:false,
cache:false,
href:'getexpandwell.php?api='+row.api,
onLoad:function()
{ $('#wells').datagrid('fixDetailRowHeight',index); }
});
$('#wells').datagrid('fixDetailRowHeight',index);
}
});
                </script>

And the origional table that is being expanded...

Code:
                <table id="wells" class="easyui-datagrid" title="<?php echo "$wellname $wellnum"?>" style="width:100%;height:300px"
                    pagination="false" idField="api" fitColumns="true" url="getwell.php?api=<?php echo $api?>"
                    collapsible="true" singleSelect="true"  resizeHandle="both"
                    autoRowHeight="true" nowrap="false">
                    <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>
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: August 20, 2014, 05:46:49 PM »

Please try this:
Code:
$('#tt').datagrid({
view: detailview,
detailFormatter: function(rowIndex, rowData){
return '<div class="ddv" style="padding:5px 0"></div>';
},
onExpandRow: function(index,row)
{
//...
},
onLoadSuccess: function(data){
if (data.rows.length){
$(this).datagrid('expandRow', 0);
}
}
});
Logged
wexwell
Newbie
*
Posts: 8


View Profile Email
« Reply #2 on: August 21, 2014, 10:28:23 AM »

Works perfectly, TYVM!  Grin

My code is now listed below;

Code:
                              $('#wells').datagrid(
{
view: detailview,
detailFormatter:function(index,row)
{return '<div class="ddv" style="padding:5px 0"></div>';},
onExpandRow: function(index,row)
{
var ddv = $(this).datagrid('getRowDetail',index).find('div.ddv');
ddv.panel(
{
border:false,
cache:false,
href:'getexpandwell.php?api='+row.api,
onLoad:function()
{ $('#wells').datagrid('fixDetailRowHeight',index); }
});
$('#wells').datagrid('fixDetailRowHeight',index);
},
onLoadSuccess: function(data){
if (data.rows.length){
$(this).datagrid('expandRow', 0);
}
}
});
« Last Edit: August 21, 2014, 10:41:52 AM by wexwell » 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!