Results 1 to 6 of 6

Thread: Changing TextField.maxLength On The Fly

  1. #1
    Sencha User
    Join Date
    Sep 2008
    Posts
    85

    Default Changing TextField.maxLength On The Fly

    I have and EditorGridPanel. Column one contains a dropdown. Depending on which value is chosen in the dropdown I need to set the maxLength attribute of the TextField editor in the second column. I do not see any method or public property in TextField at looks like it will enable me to do this. Any ideas how I could do this?

    Thanks!

  2. #2
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996

    Default

    That only does validation you realize, not limit how many characters it will allow to be typed in.

    Looks like you just need to access the editor and set the property.

    Code:
    myEditor.maxLength = 25;
    So store a reference in some way.

  3. #3
    Sencha User
    Join Date
    Sep 2008
    Posts
    85

    Default

    Quote Originally Posted by mjlecomte View Post
    That only does validation you realize, not limit how many characters it will allow to be typed in.

    Looks like you just need to access the editor and set the property.

    Code:
    myEditor.maxLength = 25;
    So store a reference in some way.
    I tried var myEditor = cm.getCellEditor(col, row)
    myEditor.maxLength = x
    but the editor of the cell still has the maxLength the columnmodel specified.

  4. #4
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996

    Default

    I created a reference before specifying it in the column model. I don't know that what you did is accessing the same object or not.

  5. #5
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996

    Default

    Quote Originally Posted by mjlecomte View Post
    I created a reference before specifying it in the column model. I don't know that what you did is accessing the same object or not.
    I just checked, they are not the same object.

  6. #6
    Sencha User
    Join Date
    Sep 2008
    Posts
    85

    Default

    Ok, I instantiated the editor and passed the instance to the column model. Then I referenced the instance of the editor directly and was able to change the maxLength on the fly.

    It would be interesting if a ExtJS developer would comment on what cm.getCellEditor(col, row) returns.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •