javascript - using jqGrid to display json data in rails 3 application -


i’m trying use jqgrid display records rails 3 model , having massive amount of problems in getting records grid

i’m trying jqgrid call url controller index method returns json see below example

[ {   "device":   {     "created_at":"2012-09-10t09:43:08z",     "host":"myhost",     "id":1,     "updated_at":"2012-09-11t07:48:30z"   } } ] 

here example of javascript call displays grid on page

<script type="text/javascript">         jquery(document).ready(function(){           jquery("#mylist").jqgrid({              url:'/devices.json',              datatype: "json",              colnames:['id', 'hostname'],              colmodel:[                {name:'device.id',width:55},                {name:'device.host', width:200}             ]           });         }); </script> 

if go /devices.json see json file being returned , i’ve tried using absolute , relative links well, i’ve tried changing colmodel values use id or host instead of device.id , device.host

the grid display it’s data can’t access to

i’m sure i’ve missed simple can give me clue problem i’d grateful, if there way use local data , access @devices object use in view again grateful


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -