Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

252
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda