Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • asingla
    started a topic Computing URL for link type ListGridField

    Computing URL for link type ListGridField

    We have a list grid where I have three columns for three different link to send user to three different pages. I was using icon field and was handling onclicks events to send user to different pages. The requirement came to show that as link so that user can open the link in new tab if need be. I am trying to use "link" type. I see the linkText property to show same icon for all rows but I think there is no way it allows me to compute a link value based on other properties of the grid.

    I can always implement this field as type "any" and then construct the html in formatCellValue but I still thought to check to see I am missing anything about "link" type attributes to handle this use case.

    Code:
    {  
       name:"view", width:30, type:"any", title:" ", align:"center", canExport:false, showHover:true, canHover:true, canDragResize: false, showDefaultContextMenu:false,canFilter:false, canSort:false, canHide:false, 
       hoverHTML:function() {      
           return "View";
       },
       formatCellValue: function (value, record) {      
          var linkIconHtml = isc.Canvas.imgHTML("[SKIN]/actions/view.png",16,16)      
         return isc.Canvas.linkHTML(<url>, linkIconHtml, "_self")    
      }
    }

  • Blama
    replied
    Hi asingla,

    it's not a "real" <a href> link, but a javascript call you get on cell click. So yes, right click would not be possible, but a new window with _blank will automatically open in a new tab.

    Best regards
    Blama

    Leave a comment:


  • asingla
    replied
    It is not going to work. What if user right clicks and then selects "open in new tab". javascript code won't execute at that point and will not work.
    Last edited by asingla; 8th Feb 2019, 10:51.

    Leave a comment:


  • Blama
    replied
    Hi asingla,

    I'm using a recordClickHandler for this in SmartGWT
    Code:
            addRecordClickHandler(new RecordClickHandler() {
                @Override
                public void onRecordClick(RecordClickEvent event) {
                    Window.open(StringUtil.asHTML("https://maps.google.de/maps?q=" + URL.encodeQueryString(buildQueryString(event.getRecord()))),
                            "_blank", "");
                }
            });
    You'll need some replacement for Window.open, but a recordClickHandler should solve your task as well.

    Best regards
    Blama

    Leave a comment:

Working...
X