Sunday, November 3, 2019

How to show multiple records with the same primary key in ExtJs Store. ------ Ext store primary key field unavailable

■ Keyword
Extjs Ext Javescript
Store
proxy idProperty
■ Issue
Data.items Data.items
ID NAME ID NAME
111 A111 111 A111
111 A222        
111 A333    
222 B222 222 B222
■ Solution
STEP①              
  Ext.define(modelName, {  
  extend : "Ext.data.Model",  
  fields : ["num",  
  proxy: {  
   
    type: 'ajax',  
    reader: {  
          type: 'json',  
          idProperty: 'undefined'}}  
                 
STEP②  
   
  store.add(data.items); store.loadRawData(data.items);
                 
idProperty will decide which field will be primary key.
Default is field:"ID".