hflipman
14 Jun 2012, 2:32 PM
Hi,
I'm trying to use the 'contenteditable' attribute inside a grid cell and it is not working. Using 'contenteditable' in a window works fine.
Here is my test page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Edit</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-4.1.0-gpl/resources/css/ext-all.css" />
<script type="text/javascript" src="http://extjs.cachefly.net/ext-4.1.0-gpl/ext-all-debug.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
var win = new Ext.Window({
title : 'Edit in Window',
width : 350,
height : 350,
html : '<div contenteditable="true"><div>well?</div><div>can i edit this?</div></div>'
});
win.show();
function render(val) {
return '<div contenteditable="true">' + val + '</div>';
}
// create the Grid
var grid = new Ext.grid.GridPanel({
store : {
fields: ['id', 'name', 'email'],
data: [
{ 'id': '1', "name": 'Lisa', "email": "lisa@simpsons.com" },
{ 'id': '2', "name": 'Bart', "email": "bart@simpsons.com" },
{ 'id': '3', "name": 'Homer', "email": "home@simpsons.com" },
{ 'id': '4', "name": 'Marge', "email": "marge@simpsons.com" }
]
},
columns: [
{
id :'id',
header : 'ID',
dataIndex: 'id'
},
{
header : 'Name',
dataIndex: 'name'
},
{
{
header : 'Email',
renderer : render,
dataIndex: 'email'
}
],
height: 200,
width: 400
});
var gridwin = new Ext.Window({
title : 'Grid',
width : 400,
height : 200,
layout : 'fit',
items : [
grid
]
});
gridwin.show();
});
</script>
</head>
<body>
</body>
</html>
Clicking on the window allows me to edit the text. But clicking on the cell grid does not. Any ideas why?
As a background on why I'm looking at this. In my app, inside a grid cell will be a complex layer of divs with different markup based on the content coming from the store (this is all generated in the renderer).
And the user needs to be able to change the text inside of it while leaving the markup untouched. I've tried using the ExtJS HTML editor but it's kinda awkward and it behaves differently on different browsers.
Thanks.
Henk
I'm trying to use the 'contenteditable' attribute inside a grid cell and it is not working. Using 'contenteditable' in a window works fine.
Here is my test page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Edit</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-4.1.0-gpl/resources/css/ext-all.css" />
<script type="text/javascript" src="http://extjs.cachefly.net/ext-4.1.0-gpl/ext-all-debug.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
var win = new Ext.Window({
title : 'Edit in Window',
width : 350,
height : 350,
html : '<div contenteditable="true"><div>well?</div><div>can i edit this?</div></div>'
});
win.show();
function render(val) {
return '<div contenteditable="true">' + val + '</div>';
}
// create the Grid
var grid = new Ext.grid.GridPanel({
store : {
fields: ['id', 'name', 'email'],
data: [
{ 'id': '1', "name": 'Lisa', "email": "lisa@simpsons.com" },
{ 'id': '2', "name": 'Bart', "email": "bart@simpsons.com" },
{ 'id': '3', "name": 'Homer', "email": "home@simpsons.com" },
{ 'id': '4', "name": 'Marge', "email": "marge@simpsons.com" }
]
},
columns: [
{
id :'id',
header : 'ID',
dataIndex: 'id'
},
{
header : 'Name',
dataIndex: 'name'
},
{
{
header : 'Email',
renderer : render,
dataIndex: 'email'
}
],
height: 200,
width: 400
});
var gridwin = new Ext.Window({
title : 'Grid',
width : 400,
height : 200,
layout : 'fit',
items : [
grid
]
});
gridwin.show();
});
</script>
</head>
<body>
</body>
</html>
Clicking on the window allows me to edit the text. But clicking on the cell grid does not. Any ideas why?
As a background on why I'm looking at this. In my app, inside a grid cell will be a complex layer of divs with different markup based on the content coming from the store (this is all generated in the renderer).
And the user needs to be able to change the text inside of it while leaving the markup untouched. I've tried using the ExtJS HTML editor but it's kinda awkward and it behaves differently on different browsers.
Thanks.
Henk