EasyUI Forum
April 29, 2024, 10:44:05 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: onExpandRow action onClose?  (Read 14534 times)
kavvson
Newbie
*
Posts: 23


View Profile
« on: September 20, 2014, 07:40:52 AM »

I have such function

Code:
onExpandRow: function(index,row){
  $('#jloading').html('<img src="themes/default/images/loading.gif">');
                    var ddv = $(this).datagrid('getRowDetail',index).find('div.ddv');
                    ddv.panel({
                        height:1,
                        border:true,
                        cache:false,
                        href:'listdetail.php?listnumb='+row.number,
                        onLoad:function(){
                            $('#dg').datagrid('fixDetailRowHeight',index);
                        }
                    });
                    $('#dg').datagrid('fixDetailRowHeight',index);
$.ajax({
type: "GET",
url: 'listdetail.php?listnumb='+row.number,
success: function (d) {
// replace div's content with returned data
$('#jloading').html(d);
}
});
                },
As you see I added an ajax that shows the same result but in a div container separately from the table
Code:
$('#jloading').html(d);
, now whenever I click + as the expansion it all works fine, but when I do click the -, I would like to empty the container
Code:
#jloading

Do you have any tips?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: September 20, 2014, 08:38:40 AM »

When click the - icon, the 'onCollapseRow' event fires, in which you can write some code logic to do what you want.
Logged
kavvson
Newbie
*
Posts: 23


View Profile
« Reply #2 on: September 20, 2014, 08:41:38 AM »

Old Thank you for the onCollapseRow option, but im wondering which can be the most effective way
Code:
.val('') 
would do it properly?[/s]

Code:
onCollapseRow: $('#jinner').html(''),
  also
Code:
.val('') 
doesnt work f.e
« Last Edit: September 20, 2014, 08:43:56 AM by kavvson » Logged
kavvson
Newbie
*
Posts: 23


View Profile
« Reply #3 on: September 30, 2014, 07:23:50 AM »

Any ideas on this one?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #4 on: September 30, 2014, 07:53:34 AM »

How do you define the '#jloading'? And what do you wish to do when collapse a row? Please describe your issue in more detail.
Logged
kavvson
Newbie
*
Posts: 23


View Profile
« Reply #5 on: September 30, 2014, 10:03:09 AM »

It only loades a simple data into the div. Onclose I want it to clear the data [http://oi59.tinypic.com/dnj6z9.jpg]

code :

Container


Code:
<div class="easyui-tabs" id="accord" data-options="tabWidth:112" style="height:500px;">
<div title="Szczegóły" style="padding:10px">
<div id="jloading"></div>
</div>
<div title="Wpisy" style="padding:10px">
<div id="jinner"></div>
</div>
</div>

and my event for onExpand

Code:
                onExpandRow: function(index,row){
$('#jloading').html('<img src="themes/default/images/loading.gif">');
                    var ddv = $(this).datagrid('getRowDetail',index).find('div.ddv');
                    ddv.panel({
                        height:1,
                        border:true,
                        cache:false,
                        href:'listdetail.php?listnumb='+row.number,
                        onLoad:function(){
                            $('#dg').datagrid('fixDetailRowHeight',index);
                        }
                    });
                    $('#dg').datagrid('fixDetailRowHeight',index);
$.ajax({
type: "GET",
url: 'listdetail.php?listnumb='+row.number,
success: function (d) {
// replace div's content with returned data
$('#jloading').html(d);
}
});
$.ajax({
type: "GET",
url: 'listdetailsub.php?listnumb='+row.number,
success: function (d) {
// replace div's content with returned data
$('#jinner').html(d);
}
});
                },

Hope its enough information to help me out.

Whenever I expand I want be able to close it and remove the content ( seems like
Code:
onCollapseRow: $('#jinner').val(''),
doesnt work here )
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #6 on: September 30, 2014, 05:06:38 PM »

If you only want to clear the '#jinner' container, call 'empty' or 'html' method after the row is collapsed.
Code:
$('#dg').datagrid({
view: detailview,
onCollapseRow: function(index,row){
$('#jinner').empty();
}
})
Logged
kavvson
Newbie
*
Posts: 23


View Profile
« Reply #7 on: October 01, 2014, 02:08:31 AM »

Uncaught TypeError: undefined is not a function  after adding the onCollapseRow   VM696:8908 it is
Code:
return $.fn.datagrid.methods[_64d](this,_64e);

whole js.

http://pastebin.com/9VBG7CaU
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!