2010/7/15 ProfessionalIT <[email protected]>

> Aydın ŞEN,
>
> Can you send me a example code / project ?
>
>
*HTML:*
<table id="grid"></table>
<div id="pagergrid"></div>

*JS:*
            jQuery("#grid").jqGrid({
                    url:'your_data_loader_url',
                    datatype: 'json',
                    mtype: 'POST',
                    colNames:["Name", "Surname"],
                    colModel :[ {name:'name', index:'name'},
                                {name:'surname', index:'surname'}],

                    rowNum:10, // how many rows per page
                    scroll: true,
                    rowList:[10,20,30,40],

                    pager: jQuery('#pagergrid'),

                    sortname: 'name',
                    viewrecords: true,
                    sortorder: "asc",

                    editurl:"if the row is editable edited data will send
this url",

                    caption: "Users", //Grid Name
                    height: 300,
                    width: 480
                    }).navGrid("#pagergrid", //pager options, look at the
docs for details
                        {search:false,refresh:false},
                        {},//Edit Options
                        {},//Add Options
                        {}, //Del Options
                        {} //search options
                    );


*WEBPY:*
*
*
*i = web.input(rows = "10", page ="1")*
*#this sql is for firebird, it can change for other db servers*
*sql = "select first %s skip %s id, name, surname from table" % (i['rows'],
((int(i['page']) - 1) * int(i['rows'])))*
*#execute sql and store it in data*
*

d = { 'rows' : [] }

#important: data count in cell = column count in js (you have defined when
you build jqGrid)
for k in data:
    d['rows'].append({'id':i[0], 'cell':[i[1],i[2]]})

return json.dumps(dict)
*
*
*
*
*
*This is the main structure of client and server side. I hope it helps.*
*
*--
Aydın Şen

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" 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/webpy?hl=en.

Reply via email to