Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

251
Views
ExtJS - Make store generate IDs with numbers only

When a new entry is added to a store in ExtJS 6.2 it automatically creates a new ID with the name of the model and a numeric ID (MODEL-ID) if you didn't specify any field as ID.

Is it possible to make the store generate IDs only containing the number?

Fiddle: https://fiddle.sencha.com/#fiddle/3gk0&view/editor
Instead of User-1, User-2, User-3, only have 1, 2, 3.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to add a custom identifier setting to the model, see below. This will set the id property which is added by default to the Model even if you don't list it among fields:

Ext.define('User', {
    extend: 'Ext.data.Model',
    identifier: {
        type: 'sequential',
        seed: 1,
        increment: 1
    },
    fields: [{
        name: 'age',
        type: 'int'
    }, {
        name: 'name',
        type: 'string'
    }, {
        name: 'email',
        type: 'string'
    }, {
        name: 'phone',
        type: 'string'
    }],
});

But keep in mind that these are phantom identifiers, meaning only exist on the client. In most cases servers generate real id fields, and clients get these from servers.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!