2015-07-27 1 views
1

Je reçois l'erreur suivante lors de l'utilisation w2ui:w2ui: ERREUR: Impossible d'ajouter des enregistrements sans recid. (Obj: grille)

ERROR: Cannot add records without recid. (obj: grid) 

J'utilise la clé primaire du modèle comme recid, et il fonctionne très bien avec mes autres tables. Mais pour l'un d'eux, il donne cette erreur. Il n'y a pas de différence entre cette table et l'autre sauf les colonnes. Voici le code de la table. Je courais dans ce Django 1.8:

<script> 
    $(function() { 
     $("#grid").w2grid({ 
      name: "grid", 
      show: { 
       footer:true, 
       toolbar:true 
      }, 
      header: "List of RTN Infos", 
      columns: [ 
       { field:"app_no", caption:"Number", size:"30%" }, 
       { field:"app_name", caption:"Name", size:"30%" }, 
       { field:"app_retrieve_date", caption:"Retrieve Date", size:"30%" }, 
       { field:"app_deliver_info", caption:"Deliver Info", size:"30%" }, 
       { field:"app_deliver_mo", caption:"Deliver Month", size:"30%" }, 
       { field:"app_deliver_yr", caption:"Deliver Year", size:"30%" }, 
      ], 
      records: [ 
       {% for i in table %} 
        { rec_id:"{{ i.id }}", 
        app_no:"{{ i.app_no }}", 
        app_name:"{{ i.app_name }}", 
        app_retrieve_date:"{{ i.app_retrieve_date }}", 
        app_deliver_info:"{{ i.app_deliver_info }}", 
        app_deliver_mo:"{{ i.app_deliver_mo }}", 
        app_deliver_yr:"{{ i.app_deliver_yr }}", 
       {% endfor %} 
      ], 
      onDblClick: function(event) { 
       url = "/app/update_item/" + event["recid"] 
       console.log(url) 
       $("#modal").modal({remote:url}) 
       $("#modal").removeData() 
      } 
     }); 
    }); 
</script> 

Répondre

0

Jolie que vous devez utiliser à la place recidrec_id

 records: [ 
      {% for i in table %} 
       { **recid**:"{{ i.id }}", 
       app_no:"{{ i.app_no }}", 
       app_name:"{{ i.app_name }}", 
       app_retrieve_date:"{{ i.app_retrieve_date }}", 
       app_deliver_info:"{{ i.app_deliver_info }}", 
       app_deliver_mo:"{{ i.app_deliver_mo }}", 
       app_deliver_yr:"{{ i.app_deliver_yr }}", 
      {% endfor %} 
     ],