Menu

Update features

2005-05-23
2013-04-22
  • Florent Selva

    Florent Selva - 2005-05-23

    Hi,

    thanks for your project.

    1) I'd like to use updatable features of your grid.

    I need a way to mark up updated rows.

    The only place I found to insert my code is the validateFunction property.

    Do you see a better way?

    2) Do you intend to implement scrolling features in your grid

    Regards

     
    • Luis Fernando Planella Gonzalez

      Thanks for your appreciation.

      The answers:
      1) There are two ways to get the updated data:
      * Put a name on each control (on the EditControl's 'name' property). So, when the form is submitted, you will have a parameter array with that name. This way is better when you have all rows on the table (non-visible rows are not submitted) and when radios and checkboxes editControl types are not used, because the generated name on those controls is controlName + '_' + rowId (this is because the radio and checkbox browser semantics. if every radio on the table had the same name, only one would be selected on the entire table, not one per row), so it's harder to retrieve the values, but not impossible.
      * Use the table's encode method. This will return a big string, containing all values on the table. The table properties valueSeparator, columnSeparator and rowSeparator are used as delimiters. So, on server, you would have split the data with those separators. Check the API documentation for more details on the encode method.

      2) The scrolling is not planned, because the table columns may have their widths as percentual values, or any other possible unit, not only pixels. So, features like user column resizing and scrolling are not trivial (and, as far as I know, not even possible) to implement. You can, however, put the table inside a div with a fixed width and height and set it's style to: overflow:auto or overflow-y:sroll;overflow-x:hidden, where you would have both scrolls or only vertical scroll.

      The answer was a bit large, but I hope it helps.

       
    • Florent Selva

      Florent Selva - 2005-05-25

      Luis,

      I should be more precise.

      I'd like to reduce client / server traffic and db updates. I need a kind of encode method, returning values only for rows which have been changed.

      So, I need to mark up modified rows on the client, and I think the handlers could help me. But I do not know which handler is the best to compare old and new values (and if it's possible): validateFunction, finishEdit, updateValue... there is a lot of possibilities.

      Another issue:

      My users are allowed to key null values in text control of the grid, and I need also your very useful mask.

      currentCol.getMaskFunction =
          function(control, column, row) {
            return new InputMask( "u", control ) ;      
      } ;         

      currentCol.getMaskFunction =
          function(control, column, row) {
            return new NumberMask( new NumberParser( 0 ), control, 3 );
          }; 

      But with the masks, I cannot key null values.

      I noticed while deleting values in text control, the updateValue method weren't applied, and so, the control is empty (he's null) but the corresponding cell value keep its last non null value.

      While submiting the form, the finishEdit method is always applied (because of the onBlur handler), so I've mofified that method in JavaScripTable.js to first call updateValue:

          /*
           * Finishes the editing of a field, formatting it's value
           */
          this.finishEdit = function(rowId, columnIndex) {
         
          /* First call to updateValue */       
          this.updateValue( rowId, columnIndex ) ;
         
          /* No more changes */
          ...
      }
                 
      It seems to work, but you may have a better way.

      All I need is in your nice component but those two issues.

       
    • Luis Fernando Planella Gonzalez

      Florent Selva:
      It has been a long time since my last visit on the online sf.net forums, and I was surprised I have not been mailed by your post... The fact is that my mail was wrong on the project page, so I didn't see your post. Sorry!
      Well, you went deep in the code!
      Hope I can help you...
      The updateValue was really not beeing called on that case... And, as you suggested, now there's another column property called allowEmptyValue.
      Those changes are on the CVS HEAD.
      About tracking changes and the IE leak, I'll try to figure out how to do this, and if it's possible.
      Thanks for your feedback and, again, sorry for the LOOONG delay!

       
    • Florent Selva

      Florent Selva - 2005-11-26

      Luis,

      No problem for the delay.

      Happy to see you're in the place!!!

      I sent you another mail, but I guess you didn't receive it:

      when setting visible property to false for columns, the "sort link" do not sort the correct column. To be more concise, in the render method:

      column.index instead of i

      =>

      buffer.append(" onclick=\"").append(tableVar).append(".setSort(").append(column.index).append(");\" onMouseOver=\"window.status='").append(this.sortMessage).append("';return true;\" onMouseOut=\"window.status='';return true;\"");

      instead of:

      buffer.append(" onclick=\"").append(tableVar).append(".setSort(").append(i).append(");\" onMouseOver=\"window.status='").append(this.sortMessage).append("';return true;\" onMouseOut=\"window.status='';return true;\"");

      Correct?

      In fact I use a lot your grid, but I've a some specific needs. I try not to change your code by using a TableParameter class the more as possible.

      Tell me if you're intereted in how I use your grid.

      Muito Obrigado!

       
    • Luis Fernando Planella Gonzalez

      For sure I would like to know wich features you use and wich you would like to have... perhaps we could work on them...
      Also, if you would like to mail me, feel free: lfpg.dev at gmail.com
      Thanks again for your feedback!

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.