Results 1 to 6 of 6

Thread: [B1] Model idField type is set to auto

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User aflx's Avatar
    Join Date
    Jun 2011
    Location
    Berlin, Germany
    Posts
    64
    Vote Rating
    0
      0  

    Default [B1] Model idField type is set to auto

    Hi,

    I found out, that the type of the idField is always auto because of this in the Model.js:

    Code:
    idField = fieldsCollection.get(idProperty);
    if (!idField) {
      fieldsCollection.add(new Ext.data.Field(idProperty));
    } else {
      idField.setType('auto');
    }
    So if I want to use the id as int for my SqliteProxy with fieldOptions PRIMARY KEY AUTOINCREMENT this will not work!

    I think, you are doing this because of the different identifier (squential, uid, default...). But maybe you can check there first, which identifier is used before the type gets overridden with auto?

    Alex

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      0  

    Default

    I would agree. This was done intentional but I think a check should be done.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    11
      0  

    Default

    Would it be possible to convert the id value using parseInt inside the SqlLite proxy?

    Also, the auto field type should still allow you to use actual integers. Why would the sql lite database not work with field type auto?

  4. #4
    Sencha User aflx's Avatar
    Join Date
    Jun 2011
    Location
    Berlin, Germany
    Posts
    64
    Vote Rating
    0
      0  

    Default

    At least I have to know which type I have to use for my table rows, when I am creating the SQL CREATE statement.

    So I would suggest, that auto is set only when no other field type is specified in the model?

  5. #5
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    11
      0  

    Default

    I'm sorry this was marked fixed. That was unintentional.

    The problem is that the automatically generated id's are strings like 'ext-record-1'. For consistency, this id is just like any other id until it is changed by the server or client side, and thus needs the id field to be type auto.

    Maybe I can add a configuration on the identifier that indicates the type the id's it produces are. This way you could make a purely sequential integer identifier (Ext.data.identifier.Sequential) which would keep the field as type 'int'.

    We are also still discussing internally how we can keep the identifier's seed in sync with the local storage database.

  6. #6
    Sencha Premium Member
    Join Date
    Jul 2014
    Posts
    20
    Vote Rating
    1
      0  

    Default

    Was this ever resolved? I'm seeing my idProperty fields being set to 'auto' somewhere even though I indicate that they should be 'int'

Posting Permissions

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