meteormeteor-autoform

options in autoform meteor doesnt take larger array


If playersData.length > 60 (see in helper function) it is not populating the list in the dropdown but if it is less than 60, then it is working. I am new to Meteor, I couldnt find anything about this. Actually my playersData is array of length 250. I need a solution to work for larger array.

    Myproject.Schema.UserDetails = new SimpleSchema({
        
           userLevel: {
              type: String,
              optional: true,
              label: "",
              autoform: {
                afFieldInput:{
                   type: 'select',
                   firstOption: false,
                options: function () {
                    return [{"label":"John","value":"1"}
                        ,{"label":"Mary","value":"2"}
                        ,{"label":"Harry","value":"3"}];
                }
              },
              afFormGroup: {
                label: false
              }
             }
          }
     })

My html file : {{>afQuickField name="userLevel" options=playerLevel }}

    Template.PlayersGame.helpers({
        playerLevel() {
            const instance = Template.instance();
            var playersDataObj = instance.playersDataModel.get('playersData') || {};
            var playersData = playersDataObj.data; // this is an array now 
            var arr = []; 
            for(var i=0;i<playersData.length;i++){
                arr.push({label:playersData[i].name,value:playersData[i].level});
            }
            return arr; // this is an array containing only label and value
        },
    
    });

Solution

  • As found in comments, the issue was a duplicate value in playersData rather than the length of the array.