client side script when selecting a row in a grid

hi @ all

 

does anybody know how I can add a client side script on a grid which is executed when a user selects a row?

In v7.6 it was very easy. But in v9 we just see this "client extensions" field in the property pane. So what do I have to type in there ?

 

thanks and kind regards

 

chris

Tagged:

Comments

  • In order to add client-side scripts to grids the grid must be editable.  This means that the grid must be associated with a table-based business object that is not set as "read-only".  When you look at the properties of a grid associated with an editable table-based business object you will see two new properties on the grid:

     

    • On cell entry
    • On cell exit

     

  • I will answer my own question. maybe it will help others a bit.

     

    It is not possible to add some client side scripts on a grid. I tried this and get the error message that this is only possible in the special "On Click, ..." property Items.

    Because there are no such property items at a grid (on an admin form) it is not possible to do so.

     

    But I found a way to have client side events on a grid. Be careful.It is a hack !!!And I am sure if you ask the metastorm guys they will answer that this is not supported ;)

     

    1) create a client side script. (for example with a function named "showWaiter()")

    2) manipulate the column in your select statement of the BO in the following way:

    SELECT 
    id,
    alias AS alias,
    '<p onclick="showWaiter();">' + alias + '</p>' AS caption,
    FROM ...
    

     

    3) now you have your client side script event everytime you click the cell in the grid

    Perhaps Rob or any other Metastorm employee can give us a short statement while this is not supported anymore in version 9. We need this because we do a lot of reloading on a grid-row selection whicht takes about 2-3 seconds. And for this I will show the user a small message "Please Wait. Still Loading"

     

    If anyone has some other ideas how to do that it would be nice to hear ... ;)

     

    kind regards

     

    Chris 

  • oh scott was a bit faster than me ;)

    But what can you do with a grid on an admin form?
    As I wrote we need to inform the user that there is still something happens in the background...

    chris

  • Sorry Christian, but it looks like you are limited to attaching client-side event handlers to editable grids using the designer today.  I would suggest that you submit an enhancement request to get client-side event properties in non-editable grids.

  • Sorry Scott

     

    I hope this is a bad joke ?!

     

    There is a functionallity which works in v7.6. And this is a standard functionality. And now you say that I have to write an enhancement request for a feature which exists in an older version???

     

    Do I have to write an enhancement request for the possibility to click on a button in version 9.5? What comes next?

     

    I can understand if you kill some hacks on the system which where not supported in the older versions of mbpm. But please keep the functionality which was already there.

     

    What is going wrong there at Metastorm?

     

    Please have a look at this!

     

    Chris

     

  • I believe our grids are behaving in the same manner as v7.6.  There has never been a row level client side event and the cell level events were only for the editable grid.  If you think this is incorrect, please feel free to PM me and I can have a quick review with you.

  • I agree with Rob. IIRC, Client Scripts never did work for read-only grids, even though there was a place to add them. If you do have an example, I'd be interested to see it as it is something we have wanted to implement for a while.

  • There was "When user selects row" in 7.6 which I used a lot in readonly grids to get data from the selected row into fields on the form. It didn't accept vbScript, but you could use the Formula Editor or the Integration Wizard to do a lot...

  • about this disscussion...
    last post is about server side event, so it is not the topic of discussion.
    about client side API. it will be great to have clien side onclick event. coul we have this? how to send enhacement request?

  • This thread started quite a long time ago but we still have no access to a client-side event for clicking a row.

     

    The introduction of column sorting has if anything made this more important as selecting a row on a sorted grid removes the hightligting on the selected row because any server-side action seems to cause a double refresh of the grid - presumably once to refresh the data, and a second time to re-sort the grid.

     

    For the user this appears as though a grid row cannot be selected and provides a 'clunky' feel, - altogether this represents a very poor user experience.

     

    If we could select a read-only grid row and capture that row data client-side we could avoid the refresh and present a much cleaner UI for users.

     

    Any views from the OpenText product team????

     

     

  • There is a solution -- although it's a bit kludgy.

     

    in your on form load JavaScript you need a line to capture clicks to the grid

     

         document.getElementById("theGrid").onclick = Grid_onclick;

     

    then in a server side script

     

    function Grid_onclick()
    {
        if(event.srcElement.toString().substring(0,10) != "javascript"){

            var row = getCurrentRow("theGrid");
            setField("theField","",getCell("theGrid", 0, row));

        }

    }

     

    Basically if the source element is a call to javascript, that means you are sorting the table.  Else proceed as normal.  Obviously this is IE code, you'd have to modify for FireFox, Chrome etc.