Announcement

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

  • arpitagrawal
    replied
    Hi Admin,

    I am facing one issue in my Application i.e. there is a requirement of putting conditional hyperlinking in ListGrid.

    Explaining it further- like I have multiple data in List Grid and I want to put hyperlinking on that data If the condition met's and otherwise i have to put List Grid field Type set to "TEXT".

    Do Needful its very urgent.got stuck in middle of the application.

    Leave a comment:


  • Jennifer8899
    replied
    Help

    Originally posted by stonebranch1 View Post
    I now removed the link completely and just use the CellFormatter which I guess is what you had suggested... Works great.

    Thanks
    I have the same problem, could you show the CellFormatter code?

    Leave a comment:


  • stonebranch1
    replied
    I now removed the link completely and just use the CellFormatter which I guess is what you had suggested... Works great.

    Thanks

    Leave a comment:


  • stonebranch1
    replied
    I got the link to work as we want by using the type LINK and setting the target to "javascript". Then by using a CellFormater we creating a custom link that the anchor tag onclick makes a call into our javascript which does what we want (pops up a window with a populated form).

    This works great!

    Leave a comment:


  • stonebranch1
    replied
    Our customers want the action that takes place (we pop up a smartgwt window containing a form with data loaded from the server) to happen only when they click on the link. They like the visual indication of the link, knowing clicking on it will cause the above action. They did not like this action happening when they just clicked anywhere in the cell (in the whitespace).

    I looked at CellFormatter but did now know how to accomplish what I want with it.
    Last edited by stonebranch1; 17 Jan 2013, 11:58. Reason: updated response

    Leave a comment:


  • Isomorphic
    replied
    If you're creating a distinction between clicking the cell vs clicking the link, that's fairly rare, and we'd suggest you just use CellFormatter to write out you're own link (which is pretty easy).

    Leave a comment:


  • stonebranch1
    replied
    Any chance of having the ability in the near future to set the target of the link field to take a handler that would then be called instead of the default behaviour? That would be very nice.

    I understand the solution you have provided above and the only issue I have with it is that the cell click handler would get called even if they click anywhere in the white space and for us, we really only want it called when you click on the link itself.

    Thanks.

    Leave a comment:


  • Isomorphic
    replied
    We realize some of the confusion here may be coming from the fact we posted a Javascript / SmartClient example rather than a SmartGWT example.
    Here's a snippet of SmartGWT script showing this working for us

    Regards
    Isomorphic Software

    Code:
    public class ListGridLink implements EntryPoint {
    
        @Override
        public void onModuleLoad() {
            ListGrid grid = new ListGrid();
            grid.setData(
                    new ListGridRecord[] {
                        new ListGridRecord() {{ setAttribute("a", "1"); }},
                        new ListGridRecord() {{ setAttribute("b", "2"); }}
                    }
            );
            
            grid.setFields(
                    new ListGridField("a"),
                    new ListGridField("b") {{
                        setType(ListGridFieldType.LINK);
                        setTarget("javascript");
                    }}
            );
            
            grid.addCellClickHandler(new CellClickHandler() {
                
                @Override
                public void onCellClick(CellClickEvent event) {
                    String fieldName = ((ListGrid)event.getSource()).getFieldName(event.getColNum());
                    if ("b".equals(fieldName)) {
                        SC.say("Clicked on field b!");
                    }
                }
            });
            
            grid.draw();
        }
    
    }

    Leave a comment:


  • Isomorphic
    replied
    We've already tested this functionality and it works as expected.

    Most likely there is something else in your code, or perhaps some third party library you are using, that is interfering with the normal operation of this feature.

    If you think you've found a bug in SmartGWT, please put together a minimal, ready-to-run test case demonstrating the issue.

    Leave a comment:


  • fairoz172
    replied
    Hi,

    Sorry the problem is not yet solved.

    i have set setTargert to javascript.

    but hyperlink is not working. On clicking hyerlinked content it is not calling cell click event.

    then clicking in the cell not in the hyperlinked content is default calls cell click event.

    then what is the solution to make the cell click call on clicking Hyperlinked content.

    Thanks

    Leave a comment:


  • Isomorphic
    replied
    Once again:
    - if you use linkType "javascript", CellClick will be called
    - if you do not use linkType "javascript", CellClick will not be called, and this is by design (the browser is handling the link directly).

    Leave a comment:


  • fairoz172
    replied
    hi,

    our issue is, the link is not calling the cellclick event on clicking the hyperlink.

    thanks

    Leave a comment:


  • Isomorphic
    replied
    This request isn't making any sense to us.

    If you want a "link" field to behave like a normal web link and open a new page, that's the default behavior, just don't set anything.

    If you want it to call your code instead, set the target to "javascript" and use the CellClick event.

    These behaviors are mutually exclusive (you can't have both).

    If you want something else entirely, use a CellFormatter to output your own HTML cell contents.

    Leave a comment:


  • fairoz172
    replied
    Hi,

    sorry i didn't get.
    our bug is the grid filed's content is not working as a hyperlink even i have set the setTarget("javascript"). it just working as on grid's cellclick event.

    the sample code is:

    ListGridField firstField = alertGrid.getField(Constants.BANK_ALERTS_BANK_ALERT_PROFILE_ID);
    firstField.setType(ListGridFieldType.LINK);
    firstField.setTarget("javascript");

    alertGrid.addCellClickHandler(new CellClickHandler()
    {
    @Override
    public void onCellClick(CellClickEvent event)
    {
    ListGridField field = alertGrid.getField(event.getColNum());
    String fieldName = field.getName();
    if (fieldName.equals(Constants.BANK_ALERTS_BANK_ALERT_PROFILE_ID))
    {
    int profileId = bankAlertsGrid.getSelectedRecord().getAttributeAsInt(Constants.BANK_ALERTS_BANK_ALERT_PROFILE_ID);
    displayProfileDetailPopUp(profileId);
    }
    }
    });
    Last edited by fairoz172; 16 Dec 2012, 21:52.

    Leave a comment:


  • Isomorphic
    replied
    Here's an example that should demonstrate this working.
    If you still can't get your expected behavior within the app, please show us a test case we can run and describe your expected behavior (and what you're seeing instead)

    Thanks
    Isomorphic Software
    Code:
    isc.ListGrid.create({
        ID:"testGrid",
        data:[{a:"1", b:"2"}],
        fields:[
            {name:"a"},
            {name:"b", type:"link", target:"javascript"}
        ],
        cellClick:function (record,rowNum,colNum) {
            if (this.getFieldName(colNum) == "b") {
                alert(1);
             }
        }
    });

    Leave a comment:

Working...
X