I'm using the "represent" field argument to make jqgrid show correctly the foreing key fields. For example, let's assume we have the category/product model. We want to use jqgrid with the producs table. If we include the product.category field, jqgrid shows None for that column (notice that it doesn't show the integer value that the field contains). So I made something like this to show the name of the category: "db.category.product.represent = lambda value:db.category[value].name"
Though I was trying to exclude the "id" column from being shown, I think hiding it it's good enough for the case. Thanks a lot! On 11 ene, 11:15, Richard Vézina <[email protected]> wrote: > You can also use represent to make a link to update your record like this : > > In the controller : > db[request.args(0)].id.represent=lambda id:\ > > A(T('Access'),_href=URL(r=request,f='read',args=(db[request.args(0)],id))) > > Richard > > 2011/1/11 Kenneth Lundström <[email protected]> > > > If I remember correctly the Id field has to be included but you can hide > > it? > > > Kenneth > > > ----- Ursprungsmeddelande ----- > > > yes > > > > On Jan 11, 6:00 am, Lisandro <[email protected]> wrote: > > > > I have the following model: > > > > db.define_table('ciudadanos', Field('tipo'), > > > > Field('nro_documento'), Field('valor')) > > > > > In the view, the following line shows the jqgrid with all the fields > > > > of the table (including "id" field): > > > > {{=plugin_wiki.widget('jqgrid', db.ciudadanos)}} > > > > The jqgrid shows fine. > > > > > Then, I add the "fields" argument using any subset of fields, for > > > > example: > > > > * {{=plugin_wiki.widget('jqgrid', db.ciudadanos, fields='id, > > > > nro_documento')}} > > > > * {{=plugin_wiki.widget('jqgrid', db.ciudadanos, fields='id, tipo, > > > > valor')}} > > > > * {{=plugin_wiki.widget('jqgrid', db.ciudadanos, fields='id, > > > > valor')}} > > > > Notice that "id" field is always present. > > > > > But when I exclude the "id" field from the "fields" argument, then no > > > > data is shown in the jqgrid. For example: > > > > * {{=plugin_wiki.widget('jqgrid', db.ciudadanos, fields='tipo, > > > > nro_documento')}} > > > > * {{=plugin_wiki.widget('jqgrid', db.ciudadanos, fields='valor')}} > > > > In this cases the jqgrid doesn't show data. > > > > > ¿Is it extrictly necessary to include "id" field in jqgrid? > >

