我尝试使用下面的代码在Gijgo网格中显示我的数据库记录。不幸的是,它不起作用,因为Gijgo默认情况下需要没有键的JSON数据。在
据我所知,解决这个问题有两种选择:
model
,pk
,fields
),这是Gijgo所接受的你知道我怎么解决这个问题吗?在
编码
demand = Demand.objects.filter(week__number=request.GET["weeknumber"], week__year=request.GET["weekyear"])
response = serializers.serialize("json", demand)
return HttpResponse(response, content_type='application/json')
[{"model": "demand", "pk": 4, "fields": {"week": 3, "model": 1, "product": 3, "type": 7, "build": 1, "sdna": 1234, "rcna": 234234, "sdeu": 3333, "rceu": 433, "ssd": 53, "src": 63, "notes": "fafd"}}]
可以使用.render()方法修改服务器对gijgo网格可用的javascript数组的响应。您可以在http://gijgo.com/grid/methods/render上看到一个示例
如果修改服务器上的响应并希望以自定义字段名返回信息,还可以使用http://gijgo.com/grid/configuration/mapping.dataField和http://gijgo.com/grid/configuration/mapping.totalRecordsField。在
相关问题 更多 >
编程相关推荐