EasyUI Forum
June 26, 2024, 12:31:39 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: 1 2 [3] 4 5
31  General Category / EasyUI for jQuery / How to set defaultFilterOptions in datagrid-filter? on: January 15, 2019, 09:48:04 PM
Since the defaultFilterType defaults to text, why is the following code invalid and error?

Code:

$('#dg').datagrid({
url:...,
        columns:...,
pagination:true,
defaultFilterOptions:{
placeholder:'enter filter text here...'
}
}).datagrid('enableFilter')

32  General Category / EasyUI for jQuery / Re: The value in the onCellEdit event is always undefined on: January 10, 2019, 07:34:26 PM
Ok, I see. I originally thought that the key code of the input can be obtained here by the value parameter. It seems that I still have to deal with the input keydown, I hope to press the Enter key to automatically navigate to other cells.
thank you for your help!
33  General Category / EasyUI for jQuery / Re: The value in the onCellEdit event is always undefined on: January 10, 2019, 06:32:49 AM
I still don't quite understand. Even if the editCell method is executed, the value in the onCellEdit event is still undefined.
For example, if I press the Enter key in the cell, how can I get the char code:

Code:
$('#dg').datagrid({
url:'test.php',
        //...
onCellEdit:function(index,field,value){
              console.log(value)       //The initialized value from the pressed char code on keyboard
        }
}).datagrid('enableCellEditing')
34  General Category / EasyUI for jQuery / The value in the onCellEdit event is always undefined on: January 09, 2019, 10:59:03 PM
I am trying 'cellediting' and want to implement the navigation effects of up, down, left and right in the onCellEdit event.
The problem is that the value here is always undefined.
I have found similar problems in the forum, but the sample files can't be opened. Can you help me with an example or sample code? Thank you!
35  General Category / EasyUI for jQuery / Re: 'loader' attribute problem in panel on: December 27, 2018, 04:26:58 AM
It seems that this should be my local server problem. Thank you!
36  General Category / EasyUI for jQuery / Re: 'loader' attribute problem in panel on: December 27, 2018, 01:39:09 AM
Tested with this code, no matter what the href changes to, the 'onLoadError' event will not fire.
37  General Category / EasyUI for jQuery / 'loader' attribute problem in panel on: December 26, 2018, 06:31:48 AM
I encountered two problems when using the panel's loader property:

1)  If the url in ajax is wrong, how do I use the function 'error' and give an error message? I tried to solve it in the onLoadError event, but it didn't work.

2)  When using the loader, I must also set a url that is not empty, otherwise Ajax will not make a request.

These two questions are puzzling and ask for help. Thank you!
Here is the sample code:

Code:

$('#test').panel({
title: 'mytitle',
width: 300,
height: 100,
href:' ',     //The href attribute cannot be empty, otherwise the loader is invalid.
queryParams:{
v1:'abc'
},
loader:function(para,success,error){
$.get('test1.php',para,function(data){
success(data)
//If the request is wrong, how can I call the error function and give a prompt message?
})
}
})

38  General Category / EasyUI for jQuery / Add editor properties to 'onBeginEdit'. on: December 06, 2018, 10:25:49 PM
Hello,
The following code just adds an onChange property to the editor, which works fine, but the console prompts an error.
Is there any problem with this code?

Code:
onBeginEdit:function(index,row){
var ed = $(this).datagrid('getEditor', {
                index: index,
                field: 'sl'
        });
        var opt = $(ed.target)[ed.type]('options');
opt.onChange = function(value){
$('#test').datagrid('updateRow',{
        index: index,
                    row:{je:'888'}
})
};
$(ed.target)[ed.type](opt)

39  General Category / EasyUI for jQuery / Re: How to undo the modification of a single data row in the datagrid? on: December 05, 2018, 09:48:26 PM
Moreover, even if data is restored using updateRow, this data row will still exist when using ‘getChanges’.
Is there any way to deal with it more perfect?
40  General Category / EasyUI for jQuery / Re: How to undo the modification of a single data row in the datagrid? on: December 05, 2018, 09:06:21 PM
Oh, it's my object reference problem.
Thank you for your reply and help!

After testing, if all the columns have content before editing, this processing method is no problem. If it is a newly added row, the row in the onBeforeEdit event is {}, and then it is useless when updating with the updateRow method in the onAfterEdit event.
How can I get the full value of the row in the onBeforeEdit event?
41  General Category / General Discussion / Re: Datagrid add a action button on: December 05, 2018, 08:29:51 PM
Looked at the elements carefully and solved:

tr.find('td[field="id"]').text();
42  General Category / EasyUI for jQuery / Re: How to undo the modification of a single data row in the datagrid? on: December 05, 2018, 07:55:55 PM
I tried to add a data property to the row in the onBeforeEdit event to save the pre-edit value, then get the data in onAfterEdit and set the value to the row.
However, it is invalid!

Code:
onBeforeEdit:function(index,row){
            row.editing = true;
            $(this).datagrid('refreshRow', index);
      row.data = row;
},

onAfterEdit:function(index,row,changes){
            var oldrow = row.data;
            delete row.data;
            var inserted = $(this).datagrid('getChanges','inserted');
            var updated = $(this).datagrid('getChanges','updated');
            $.post('crud.php',{
                type: (inserted.length > 0) ? 'add' : 'update',
                row:row
            },function(data){
if(data){
            row.editing = false;
            $('#test').datagrid('refreshRow', index);
                }else{
                            row = oldrow;
            $('#test').datagrid('cancelEdit', index);
            $('#test').datagrid('beginEdit', index);
}
            })
},
43  General Category / General Discussion / Re: Datagrid add a action button on: December 05, 2018, 05:27:01 AM

In this example, how do I get the data row of index?
I know that I can use the ‘selectRow‘ method and then ‘getSelected’ to get it. But there is a problem here. If multiple rows have been selected in the datagrid, the ‘getSelected’ method does not necessarily get the row that is needed.

Code:

function getRowIndex(target){
    var tr = $(target).closest('tr.datagrid-row');
    return parseInt(tr.attr('datagrid-row-index'));
}
function editrow(target){
    var index = getRowIndex(target);
    $('#tt').datagrid('beginEdit', index);

   //How to get the data row of this index?
}

44  General Category / EasyUI for jQuery / How to undo the modification of a single data row in the datagrid? on: December 05, 2018, 04:14:32 AM
When I submit the modified data to the server in onAfterEdit, if the submission fails, how can I cancel the modification of the current row? Even if I add the cancelEdit method to it, I can't get back to the original data. I can't use rejectChanges here because it will undo all the changes in the table.
Please help, thank you.

Code:
      onAfterEdit:function(index,row,changes){
            var inserted = $(this).datagrid('getChanges','inserted');
            var updated = $(this).datagrid('getChanges','updated');
            $.post('crud.php',{
                type: (inserted.length > 0) ? 'add' : 'update',
                row:row
            },function(data){
if(data){
            row.editing = false;
            $('#test').datagrid('refreshRow', index);
                }else{
            $('#test').datagrid('cancelEdit', index);
            $('#test').datagrid('beginEdit', index);
}
            })
      },
45  General Category / EasyUI for jQuery / Re: The rows that have been deleted in the datagrid, how to restore them again? on: December 03, 2018, 02:07:05 AM
Haha, why didn't I think of using appendRow? This method is very good, although it may not be the original location after the addition.
Thank you very much, EasyUI is great, the administrator is better.
Pages: 1 2 [3] 4 5
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!