EasyUI Forum
May 21, 2024, 03:44:32 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: datagrid / getPager?  (Read 26676 times)
baxter
Newbie
*
Posts: 32


View Profile Email
« on: January 27, 2013, 04:37:09 PM »

Hello @all:

Any Ideas why this not work, i become no alert?

Code:
$('#servicegrid').datagrid({
    nowrap: false,
    striped: true,
    collapsible:true,
    url:'/manage/json.php',
    pagination: true,
    singleSelect: true,
    sortName: 'sort',
    sortOrder: 'ASC',
    fitColumns: true,
    idField:'id',
    pageSize:30,
    pageNumber: 1,
    queryParams: {"action": "service"},
    columns:[[  
{field:'id',title:'ID',width:20, sortable: 'true'},  
{field:'short',title:'Abk.', width:30, sortable: true, editor: 'text' },  
{field:'long',title:'Service', width:100, sortable: true, editor: 'text' },
{field:'dict',title:'Beschreibung', width:160, sortable: true, editor: 'text' },
        {field:'sort',title:'Sortierung', width:120, sortable: true, editor: 'numberspinner'},
        {field:'action',title:'', width:100,
        formatter:function(value,row,index){
                if(row.editing){
                    var link = '<a href="#" onclick="saverow('+index+')">Speichern</a> ';
   link += '<a href="#" onclick="cancelrow('+index+')">Abrechen</a>';
}
else {
                    var link  = '<a href="#" onclick="editrow('+index+')">Ändern</a> ';
   link += '<a href="#" onclick="deleterow('+index+')">Löschen</a>';
}
return link;
   }
        }
    ]],
    onBeforeEdit:function(index,row){    
        row.editing = true;
        updateActions(index);
    },
    onAfterEdit:function(index,row){
row.editing = false;
        updateActions(index);
    },
    onCancelEdit:function(index,row){
        row.editing = false;
        //updateActions(index);
    },
});
var p = $('#servicegrid').datagrid('getPager');
$(p).pagination({
    onBeforeRefresh:function(){
        alert('before refresh');
    }
});
$('#servicegrid').datagrid({
    nowrap: false,
    striped: true,
    collapsible:true,
    url:'/manage/json.php',
    pagination: true,
    singleSelect: true,
    sortName: 'sort',
    sortOrder: 'ASC',
    fitColumns: true,
    idField:'id',
    pageSize:30,
    pageNumber: 1,
    queryParams: {"action": "service"},
    columns:[[  
{field:'id',title:'ID',width:20, sortable: 'true'},  
{field:'short',title:'Abk.', width:30, sortable: true, editor: 'text' },  
{field:'long',title:'Service', width:100, sortable: true, editor: 'text' },
{field:'dict',title:'Beschreibung', width:160, sortable: true, editor: 'text' },
        {field:'sort',title:'Sortierung', width:120, sortable: true, editor: 'numberspinner'},
        {field:'action',title:'', width:100,
        formatter:function(value,row,index){
                if(row.editing){
                    var link = '<a href="#" onclick="saverow('+index+')">Speichern</a> ';
   link += '<a href="#" onclick="cancelrow('+index+')">Abrechen</a>';
}
else {
                    var link  = '<a href="#" onclick="editrow('+index+')">Ändern</a> ';
   link += '<a href="#" onclick="deleterow('+index+')">Löschen</a>';
}
return link;
   }
        }
    ]],
    onBeforeEdit:function(index,row){    
        row.editing = true;
        updateActions(index);
    },
    onAfterEdit:function(index,row){
row.editing = false;
        updateActions(index);
    },
    onCancelEdit:function(index,row){
        row.editing = false;
        //updateActions(index);
    },
});

var p = $('#servicegrid').datagrid('getPager');
$(p).pagination({
    onBeforeRefresh:function(){
        alert('before refresh');
    }
});
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: January 27, 2013, 07:38:40 PM »

Please refer to http://www.jeasyui.com/tutorial/datagrid/datagrid12.php.
Logged
baxter
Newbie
*
Posts: 32


View Profile Email
« Reply #2 on: January 28, 2013, 02:16:14 AM »

Thanks stworthy, but i don´t have a problem with the editor in the grid. That works all fine...

My Problem ist the getPager request, that not works. I will send a queryParams request to the rest server when i click
the refresh/reload icon on the pagination panel... But the think is, with my code i become no alert back, when i click this button.

Code:
...
var p = $('#servicegrid').datagrid('getPager');
$(p).pagination({
    onBeforeRefresh:function(){
        alert('before refresh');
    }
});
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: January 28, 2013, 07:07:40 PM »

Please refer to http://jsfiddle.net/qJ8mJ/. This example works fine. Clicking the refresh button will display the alert window.
Logged
baxter
Newbie
*
Posts: 32


View Profile Email
« Reply #4 on: January 29, 2013, 02:51:25 AM »

Thanks again;-)

I think i find the problem. I used tabs for the display content. When i use the Site without tabs, its getPager work, inside the tab, doesn't work.

Code:
function addTab(url, title, icon) {
   
    if ($('#tabs').tabs('exists', title)) {
        $('#tabs').tabs('select', title)
    } else {
        index++;

        $('#tabs').tabs('add', {
title: title,
href: url,
iconCls: icon,
closable: true,
border: 0,
selected: true
});
    }
}
Logged
baxter
Newbie
*
Posts: 32


View Profile Email
« Reply #5 on: January 30, 2013, 01:17:12 PM »

no ideas why this not work inside tabs with href content?
Logged
pratikk
Newbie
*
Posts: 49


View Profile Email
« Reply #6 on: March 31, 2014, 11:52:35 AM »

Same thing happened to me. I am using tabs and getPager doesn't work !
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!