gerry / django-jqgrid Goto Github PK
View Code? Open in Web Editor NEWdjango utilities allowing easy handling and configuration of jqGrids
License: BSD 3-Clause "New" or "Revised" License
django utilities allowing easy handling and configuration of jqGrids
License: BSD 3-Clause "New" or "Revised" License
Hi all,
extra_config is a class variable, and this can lead to a bug in the case of a page containing two jqGrid objects:
gridFoo = jqGrid()
gridFoo.extra_config['editurl'] = '/foo/edit'
gridBar = jqGrid()
print gridBar.get_config() will contain {'editurl': '/foo/edit'} even it's not concerned with.
So extra_config introduced some kind of persistence across of all objects while, IMHO, it was designed to serve each object separately.
This can be solved by making it an instance variable:
class JqGrid(object):
def init(self):
self.extra_config = {}
Не реализован группировка при поиске, есть возможность сделать данный функционал?
I've found something wrong with the json.loads() in get_filters
I got this " 'module' object has no attribute 'loads' ", and then checked the "from django.core.serializers import json" to find no loads() function
my django version is old,1.2.3, maybe this leads to the error
I fixed the error with
import simplejson
filters = _filters and simplejson.loads(_filters)
Hi,
I was using this plugin and everything was working great until I needed to use Foreign Keys. Giving a field name as 'fkname__fieldname' would not populate that field in the grid. Everything else would populate fine. I inspected the json being sent to jqGrid, and it was always sending everything about my model, even though I only specified certain fields. But upon closer inspection I could see that my 'fkname__fieldname' field name wasn't present but 'fkname_id' was, even though it isn't in my model fields per se.
After stepping through the process to see what I was doing wrong I noticed in the get_json function:
193 def get_json(self, request):
194 paginator, page, items = self.get_items(request)
195 #Fix for queryset
196 if type(items) != type(ValuesQuerySet):
197 items = items.values()
198 data = {
199 'page': int(page.number),
200 'total': int(paginator.num_pages),
201 'rows': [obj for obj in items],
202 'records': int(paginator.count),
203 }
204 return json_encode(data)
Line 196: [if type(items) != type(ValueQuerySet):
] is problematic.
>>> print type(items)
<class 'django.db.models.query.ValuesQuerySet'>
>>> print type(ValuesQuerySet)
<type 'type'>
If you remove the type() around ValuesQuerySet:
>>> print ValuesQuerySet
<class 'django.db.models.query.ValuesQuerySet'>
Now my Foreign Keys are showing up in my grid.
I haven't used the queryset parameter yet, but I imagine that this wouldn't hurt it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.