Hi,

I'm trying tw.jqgrid (0.3.1, last version) in my TG2.1 app but the
grid is not shown properly in the result web page. It seems like it
appears twice in the page: one inside the other. For example, the nav
buttons (search, add, delete, etc) appear twice in the bottom of the
grid. The title of the grid and the title of every column appear
twice, too.

A summary of the code is:

class Clientes(BaseController):
    ...

    colModel = [dict(name='nombre', index='nombre', width='250',
align='center'),
                dict(name='direccion', index='direccion', width='400',
align='center'),
                dict(name='telefono', index='telefono', width='100',
align='center'),
                dict(name='ciudad', index='ciudad', width='300',
align='center'),
                ]

    grid_clientes = JqGrid('grid_clientes', url=url('/clientes/
buscar'),
                           caption='Clientes',
                           rowList=[1, 5, 10, 50], rowNum=10,
                           # name, address, phone number, city
                           colNames=[u'Nombre', u'Dirección',
u'Teléfono', 'Ciudad'],
                           colModel=colModel,
                           width='auto',
                           height=300,
                           viewrecords=True,
                           sortname='nombre',
                           rownumbers=True
                           )

    @expose('json')
    def buscar(self, **kw):

        # TODO: always the same fake data

        rows = [dict(id=1,
                     cell=[u'León Domingo Ortín',
                           '13 Rue del Percebe',
                           '917 788 042',
                           'Madrid']),
                dict(id=2,
                     cell=[u'Paco Pérez López',
                           u'c/ Alcalá',
                           '911 231 231',
                           'Madrid']),
                dict(id=3,
                     cell=[u'Mónica Sedeño Noci',
                           u'c/ Peñas Largas 16, 1ºB',
                           '919 001 002',
                           'Madrid',
                           ]),
                ]

        return dict(page=1, total=1, records=3, rows=rows)

    @expose('ateneatg2.templates.clientes.index')
    def index(self, q='', id_=''):
        qres = None
        if q:
            qres = self.grid_clientes

        elif id_:
            redirect('/clientes/operar', id_=id_)

        return dict(qres=qres)

The output from the controller seems to be fine, but it's not
correctly shown in the browser:

(blah, blah, blah)

jQuery("#grid_clientes").jqGrid({"treeIcons": null, "loadBeforeSend":
null, "treeGridModel": null, "tree_root_level": null, "onSelectRow":
null, "height": 300, "mtype": "POST", "subGridModel": null,
"subGridRowExpanded": null, "treedatatype": null, "onPaging": null,
"rowList": [1, 5, 10, 50], "rowNum": 10, "onCellSelect": null,
"afterInsertRow": null, "ondblClickRow": null, "colModel": [{"width":
"250", "align": "center", "name": "nombre", "index": "nombre"},
{"width": "400", "align": "center", "name": "direccion", "index":
"direccion"}, {"width": "100", "align": "center", "name": "telefono",
"index": "telefono"}, {"width": "300", "align": "center", "name":
"ciudad", "index": "ciudad"}], "treeGrid": false, "beforeRequest":
null, "gridComplete": null, "onHeaderClick": null, "rownumbers": true,
"width": "auto", "onSelectAll": null, "resizeStart": null,
"ExpandColClick": null, "multiselect": false, "resizeStop": null,
"toppager": false, "onSortCol": null, "onRightClickRow": null,
"sortname": "nombre", "viewrecords": true, "ExpandColumn": null,
"shrinkToFit": null, "beforeSelectRow": null, "sortorder": "asc",
"autowidth": true, "serializeGridData": null, "pager":
"grid_clientes_pager", "loadComplete": null, "toolbar": [false, ""],
"editurl": null, "sortable": false, "postData": {}, "loadError": null,
"url": "/clientes/buscar", "subGrid": false, "subGridUrl": null,
"subGridWidth": null, "multiselectWidth": 20, "datatype": "json",
"treeReader": null, "caption": null, "colNames": ["Nombre", "Direcci
\u00f3n", "Tel\u00e9fono", "Ciudad"]})

(blah, blah, blah)

if I use the following code in the template, the grid in general looks
better:

${qres()}
<!-- twice ????? -->
${qres()}

but if I use

<!-- single-one -->
${qres()}

it appears worse: one grid inside the other.

Any idea?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to