PDA

View Full Version : celldblclick does not fired if the cell contains HTML extjs 3.4.0



fakoua
9 Apr 2013, 6:55 AM
I have the following EditorGridPanel on extJS:



Ext.onReady(function () {
var myData = [[ '<SPAN STYLE=\"text-align:Left;font-family:Segoe UI;font-style:normal;font-weight:normal;font-size:12;color:#000000;\"><P STYLE=\"font-family:Arial;font-size:16;margin:0 0 0 0;\"><SPAN><SPAN>HTML </SPAN></SPAN><SPAN STYLE=\"font-weight:bold;color:#FF0000;\"><SPAN>FORMAT</SPAN></SPAN><SPAN><SPAN> TEST<BR />TEST</SPAN></SPAN></P></SPAN>', "[email protected]", "555-111-1224"],
[ 'Bart', "[email protected]", "555-222-1234"],
[ 'Homer', "[email protected]", "555-222-1244"],
[ 'Marge', "[email protected]", "555-222-1254"]];


var store = new Ext.data.SimpleStore({
fields:[ {
name: 'name'
},
{
name: 'email'
},
{
name: 'phone'
}],
data: myData
});
var grid = new Ext.grid.EditorGridPanel({
renderTo: 'grid-container',
columns:[ {
header: 'Name',
dataIndex: 'name',
width:200
}
],
store: store,
frame: true,
height: 240,
width: 500,
enableColumnMove :false,
stripeRows: true,
enableHdMenu: false,
border: true,
autoScroll:true,
clicksToEdit: true,
title: 'HTML in Grid Cell',
iconCls: 'icon-grid',
sm: new Ext.grid.RowSelectionModel({
singleSelect: true
})
});


grid.on({
celldblclick: function() {alert(1);}
});
});


the problem is, when the gridCell contains HTML data (which is my situation) when you double click on the cell with html the grid does not fire the event celldblclick.
in my application I need to display that kind of html in the grid.
how can fix this problem? anyway to bubble the event from the html to the grid?
Thanks

Please try it from: http://jsfiddle.net/VDFsq/1/

willigogs
9 Apr 2013, 9:57 AM
I guess the real question should be, why are you putting HTML into your store in the first place? :/

fakoua
9 Apr 2013, 9:59 AM
I need to dispaly HTML into my grid. that's why I put html into my store

willigogs
9 Apr 2013, 10:02 AM
Putting HTML into a store is not a normal method.

It might be a better idea to explain what you're trying to achieve, as there must be a better way to do it...

fakoua
9 Apr 2013, 10:04 AM
I'm trying to display HTML into the GridEditor Cell is there any better way? how can I display HTML into the GridEditorPanel.

willigogs
9 Apr 2013, 10:05 AM
You still haven't explained why though.

Have you looked into column renderers in the API?

fakoua
9 Apr 2013, 11:07 AM
Many thanks willigogs, I really apreciate your help.
the renderer does not solve the problem, the problem is that the cell does not fire the double click when it contains HTML tags, I've update the script to use rendere please try to click on the red html data.
http://jsfiddle.net/VDFsq/10/

willigogs
9 Apr 2013, 3:21 PM
And once again, why are you putting HTML into the store?

What requirement have you been given that has lead you to even attempt this?

I see no reason why you would ever need to (since you can achieve the exact same with a renderer), therefore why not simply leave your data as it was originally without the surrounding HTML code (as I expect it is this which is breaking any logic)?

I assume you have no cellclick issue if you remove the HTML?

fakoua
10 Apr 2013, 2:04 AM
Dear willigogs,
I use HTML because the client wants to display HTML in the gird, and regarding the rendere, In the latest script I use renderer and does not solve the problem.
Thanks