Announcement

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

    button / link inside a grid

    My first use case is simple. I need to format an HTML paragraph calculated with the content of the record. I've solved this by having one field with a formatCellValue(value,record,row,col,grid) and using the record to calculate the paragraph content.

    Now I'm trying to add "EDIT" and "DELETE" buttons to each record. There isn't a Button type. I'm still playing with the "Link" type, and my issue is how to best remember which record the link is associated with. I haven't found an example of this anywhere in the documentation. Have I missed it somewhere?

    The EDIT needs to pop-up a modal dialog, so I can't use the startEditingNew() inline editing method. The Delete needs to mark the record for deletion (and I want the link to switch to "RESTORE" or something to undo the delete).

    I'm trying to get the link to call a custom javascript function with record as the parameter.
    Last edited by tgochenour; 26 Feb 2007, 14:52.

    #2
    Hi tgochenour,

    We generally recommend triggering actions like editing or deleting via buttons and menu items that are external to the grid and which operate on the selection, and/or beginning editing in a related form immediately on click, by simply calling editRecord on recordClick. The SupplyCatalog application shows this style of editing. This maximizes use of space.

    If you decide you want links or buttons in each row within the grid, we generally recommend using cellClick to respond to clicks, and achieving the look of an HTML link or button via styling APIs, for example, using getBaseStyle() to create a custom style series for fields that should appear as links.

    Comment


      #3
      And the right-mouse context menu is a neat trick, too.

      Thanks

      Comment


        #4
        calling javascript in a link field

        Hi
        I am using list grid.The default behaviour of the Link field is it is opening a new brower window on click.

        My requirement here is to open a smartclients window object to display graph or something. For that i have just followed your reply 2. using cellClick.

        If i implement the cellClick method this method is being called for all the columns click event.
        It is giving me the clomun number and row number and a record object

        Questions
        1) How can i get the column details ( field name and value) of the column being clicked.
        2) What actually the record object will have ?

        If i get the answer for the Q1 then my proplem will be solved.

        Please help me in this...

        Comment


          #5
          The record object is the record the user clicked from the data-set of the grid -- so it is the object containing values for each field.
          You can get the fieldName from the colNum via ListGrid.getFieldName(colNum).
          You can get the field object by looking at ListGrid.getField(colNum).

          To get the value displayed in the cell from the record object, you could say
          Code:
          isc.ListGrid.create({
              ... // various properties
              cellClick:function (record, rowNum, colNum) {
                  var fieldName = this.getFieldName(colNum);
                  var cellValue = record[fieldName];
                  isc.say(cellValue);
                  // optional - return false to handle normal cell click processing
                  return false;
              } 
          });

          Comment

          Working...
          X