smas1 / geoext-viewer

Automatically exported from code.google.com/p/geoext-viewer
GNU General Public License v3.0
0 stars 0 forks source link

Attribute URL's not turned into links in DetailView #349

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have an attribute which is a URL.
Heron turns this into a clickable link in the table view.
However in the detailed view I see:

<a href="http://www.up2datecovandwarks.org...

(it truncates the end visually).

Original issue reported on code.google.com by jonathan...@warwickshire.gov.uk on 17 Mar 2014 at 4:20

GoogleCodeExporter commented 9 years ago
@Rinke : can you have a look?

Original comment by jus...@gmail.com on 4 Apr 2014 at 10:33

GoogleCodeExporter commented 9 years ago
In  FeatureInfoPanel lines 811 and further the attributes are always formatted 
to a HTML hyperlink link:

                var attrValue = feature.attributes[attrName];
                if (attrValue && typeof attrValue == 'string' && attrValue.indexOf("http://") >= 0) {
                    // Display value as HTML hyperlink
                    feature.attributes[attrName] = '<a href="' + attrValue + '" target="_new">' + attrValue + '</a>';
                }

Apearrantly in the detailed view the HTML is escaped somehow. Rinke, can you 
have a look?

Original comment by jus...@gmail.com on 14 Apr 2014 at 3:38

GoogleCodeExporter commented 9 years ago
Reproduced in example: 
http://lib.heron-mc.org/heron/latest/examples/featuregridformat
though here this seems related to GridCellRenderers not invoked in Detailed 
view.

Original comment by jus...@gmail.com on 14 Apr 2014 at 7:19

GoogleCodeExporter commented 9 years ago
Believe I fixed it already in an earlier stage.
I will check it now.

Original comment by rinke.he...@gmail.com on 15 Apr 2014 at 9:09

GoogleCodeExporter commented 9 years ago
I suppose the truncating (<a href="http://www.up2datecovandwarks.org..) is done 
because it doesn't fit in the field. In Table View also truncating is done if a 
value doesn't fit.

#3 is indeed related to GridCellRenderes. 
In Issue 317 I had a look into that: 
http://code.google.com/p/geoext-viewer/issues/detail?id=317#c29
GridCellRenderers apply to Grid Cells and not to Property View Cells.

Original comment by rinke.he...@gmail.com on 15 Apr 2014 at 11:10

GoogleCodeExporter commented 9 years ago
Yes I think this is related to the fact that PropertyGrid uses a customized 
GridCellRenderer, see PropertyGrid.js in ExtJS source:

    // private
    renderCell : function(val, meta, rec){
        var renderer = this.grid.customRenderers[rec.get('name')];
        if(renderer){
            return renderer.apply(this, arguments);
        }
        var rv = val;
        if(Ext.isDate(val)){
            rv = this.renderDate(val);
        }else if(typeof val == 'boolean'){
            rv = this.renderBool(val);
        }
        return Ext.util.Format.htmlEncode(rv);
    },

The only remedy may be to override this function and to custom rendering.

Original comment by jus...@gmail.com on 15 Apr 2014 at 11:34

GoogleCodeExporter commented 9 years ago
I might try the override.
Is there an example available online with a URL as value?
Jonathan?

Original comment by rinke.he...@gmail.com on 15 Apr 2014 at 1:13

GoogleCodeExporter commented 9 years ago
http://maps.warwickshire.gov.uk/inspire - from tomorrow morning
The libraries or schools layer or recycling centres all have URL's.

Original comment by jonathan...@warwickshire.gov.uk on 15 Apr 2014 at 2:00

GoogleCodeExporter commented 9 years ago
I think I've got it working (including some other Grid rendering), did not 
commit yet because have to clean up the code and want to test against above 
example.

Original comment by rinke.he...@gmail.com on 15 Apr 2014 at 3:56

GoogleCodeExporter commented 9 years ago
Rev 1432: Fixed the rendering in FeaturePanel.js for Detail View. E.g. when 
using HTML (like , <i>, <a>) and generating extra columns (like "More Info") 
all in the featuregridformat example).

Many thanks to Just for pointing to make change in overide-ext.js this was a 
crucial one to make the changes in FeaturePanel work!

@Jonathan: Using latest should make your URL work in Detail View.
@Wolfram: This will also solve your missing link as in 
http://code.google.com/p/geoext-viewer/issues/detail?id=333#c14

Original comment by rinke.he...@gmail.com on 16 Apr 2014 at 11:01

GoogleCodeExporter commented 9 years ago
Yup. Works great now. Thanks!

Original comment by jonathan...@warwickshire.gov.uk on 16 Apr 2014 at 11:32

GoogleCodeExporter commented 9 years ago
Great - works for me, too!

Original comment by wolfram.winter on 17 Apr 2014 at 10:15

GoogleCodeExporter commented 9 years ago
I suppose Wolfram accidentally put status on Ready (makes the issue back to 
Open).
As Jonathan already has set Verified I've put it back to Verified

Original comment by rinke.he...@gmail.com on 18 Apr 2014 at 3:10