Show Posts
|
Pages: 1 2 [3] 4 5
|
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: $('#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!
|
|
|
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: $('#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? 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)
|
|
|
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?
|
|
|
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! 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. 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. 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); } }) },
|
|
|
|