EasyUI
Home
Demo
Tutorial
Documentation
Download
Extension
Contact
Forum
EasyUI Forum
December 16, 2025, 06:04:10 PM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
EasyUI Forum
>
General Category
>
EasyUI for jQuery
>
addRow on edatagrid
Pages: [
1
]
« previous
next »
Print
Author
Topic: addRow on edatagrid (Read 14266 times)
jaimi
Full Member
Posts: 121
addRow on edatagrid
«
on:
September 11, 2012, 03:08:20 AM »
I created a edatagrid toolbar via markup.
<div id="tob_project" style="padding:0px;height:auto">
<div>
<a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true"
onclick="javascript:$(\'#dag_project\').edatagrid(\'addRow\')">zufügen</a>
</div>';
<div style="margin-left:5px">
...
</div>
</div>
But it won't add a new row to the table.
Then I added a button to the pager and added a function like this:
pager.pagination({
showPageList: true,
displayMsg : '{from} bis {to} von {total} Projekten',
buttons :[
{iconCls:'icon-add' ,handler:function(){addProject();}},
{iconCls:'icon-edit' ,handler:function(){editProject();}},
{iconCls:'icon-remove',handler:function(){removeProject();}},
{iconCls:'icon-save' ,handler:function(){saveProject();}},
{iconCls:'icon-undo' ,handler:function(){undoProject();}}
]
});//pager
function addProject(){
alert('add');
$('#dag_project').edatagrid('addRow');
}//saveProject
The alert works but it still adds no row to the edatagrid.
Has anyone an idea?
Logged
jaimi
Full Member
Posts: 121
Re: addRow on edatagrid
«
Reply #1 on:
September 11, 2012, 03:38:59 AM »
I found the reason:
The table markup has for one field a formatter function like the one in the tutorial (now comment out):
<th field="PVA_END_FORMAT" width="090" sortable="true" data-options="editor:eDAT" ' /*formatter="formatProjectEnd"*/ . '>Ende</th>
function formatProjectEnd(val,row){
var heute = new Date();
var y = heute.getFullYear();
var m = pad(heute.getMonth()+1, 2);
var d = pad(heute.getDate(), 2);
var formatHeute = y+m+d;
formatFeld = val.substr(6,4)+val.substr(3,2)+val.substr(0,2);
if (formatHeute > formatFeld){
return '<span style="color:red;">'+val+'</span>';
} else {
return val;
}//if
}//formatProjectEnd
I don't understand why the formatter restrains the addRow function from adding a new row.
Has anyone an idea?
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> News
=> General Discussion
=> EasyUI for jQuery
=> EasyUI for Angular
=> EasyUI for Vue
=> EasyUI for React
=> Bug Report
Loading...