• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to get ColNames and colModel from the controller in grails jqgrid ?

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I'm using JQgrid plugin(version 1.3.8) in grails (vesrion 2.2.4) .I want get colNames and ColModel from controller. How we can get this one ?

Example:-

__________
Controller
__________

MyController{

def columndetails={
def columnname="id,name"
render columnname as json
}

def colmodeldetails={
def details="{name:'companyname', editable: true},{name:'id',hidden:true}"
render details as json
}
}

_______
GSP
________
$(document).ready(function() {

// $.ajax({url: 'http://localhost:8080${createLink(action: 'colnames')}', success: function(data) { alert('hai'); } });
//alert("'${createLink(action: 'colnames')}'");
<jqgrid:grid
id="contact"
url="'${createLink(action: 'listJSON')}'"
editurl="'${createLink(action: 'editJSON')}'"
colNames= //Here what i have to written to call columndetails to get column names from Mycontrollee
colModel= //Here what i have to written to call colmodeldetails to get column details from Mycontrollee
sortname="'companyname'"
caption="'Company List'"
height="300"
autowidth="true"
scrollOffset="0"
viewrecords="true"
showPager="true"
datatype="'json'"
beforeSelectRow= "function (id) {
if (id !== lastsel2) {
jQuery(this).restoreRow(id,true);
lastsel2 = id;
}
return true;
}"

ondblClickRow="function(id)
{
var rowData = jQuery(this).editRow(id,true);
lastsel2=id;
}"



>

<jqgrid:filterToolbar id="contact" searchOnEnter="false" />
<jqgrid:navigation id="contact" add="true" edit="true"
del="true" search="true" refresh="true"
/>


<jqgrid:resize id="contact" resizeOffset="-2" />
</jqgrid:grid>







});


Regards,
Nazeer.....
 
Nazeer Ahammad
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi got the answer ..............................


If i use below code in gsp it is working

<g:set var="colnames" value="${new MyController().colnames()}" />
<script>
$(document).ready(function() {
...................

colNames="${colnames}"

....................

</script>

And i altered the controller like below
------------------------------------------
Class MyController
{
def colnames()
{
return "id,name".toString()
}
}


Same for coldetails also


Regards,
Nazeer
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic