Note that there are some explanatory texts on larger screens.

plurals
  1. PONo output when integrating ExtJS with Grails
    primarykey
    data
    text
    <p>I am in the process of integrating extJS with Grails.</p> <p>Below is my list action in my music.TuneController. </p> <pre><code>def list = { def tuneInstanceList = new ArrayList&lt;Tune&gt;() def tune= new Tune(); tune.playerId = "ASDF"; tune.playerPrice= "100"; tuneInstanceList.add(tune); def listResult = [ total: tuneInstanceList.size(), items: tuneInstanceList] render listResult as JSON } </code></pre> <p>My code in tune-grid.js</p> <pre><code>/* * Ext JS Library 2.0 Beta 1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ Ext.onReady(function(){ // create the Data Store var ds = new Ext.data.Store({ autoLoad: true, proxy: new Ext.data.HttpProxy({ url: 'http://localhost:8080/music'}), reader: new Ext.data.JsonReader({ results: 'total', root:'items', id:'id' }, [ {name: 'playerId' }, {name: 'playerPrice'} ] ) }); var cm = new Ext.grid.ColumnModel([ {header: "Player Id", width: 120, dataIndex: playerId }, {header: "Player Price", width: 180, dataIndex: 'playerPrice'} ]); cm.defaultSortable = true; // create the grid var grid = new Ext.grid.GridPanel({ ds: ds, cm: cm, renderTo:'grid-example', width:540, height:200 }); }); </code></pre> <p>list.gsp:</p> <pre><code>&lt;%@ page import="music.Tune"%&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;meta name="layout" content="test" /&gt; &lt;g:set var="entityName" value="${message(code: 'song.label', default: 'Song')}" /&gt; &lt;title&gt;&lt;g:message code="default.list.label" args="[entityName]" /&gt;&lt;/title&gt; &lt;g:javascript library="tune-grid"/&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="body"&gt; &lt;!--&lt;g:javascript library="examples"/&gt;--&gt; &lt;!-- EXAMPLES --&gt; &lt;div id="grid-example"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>When the action is called , I get the below as the output. It seems that the control doesnt get to the list.gsp at all.</p> <pre><code>{"total":1,"items":[{"class":"music.Tune","playerId":"ASDF", playerPrice":"100","playerDep":null}]} </code></pre> <p>Could you tell me what I am doing wrong here?</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload