1

I am getting the following error when using w2ui:

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

I am using the primary key of the model as the recid, and it works fine with my other tables. But for one of them it is giving this error. There is no difference between this table and the other except the columns. Below is the code for the table. I am running this in 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>
abden003
  • 1,325
  • 7
  • 24
  • 48

1 Answers1

0

Pretty sure you should use recid instead rec_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 %}
        ],