This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Regarding dataUrl in Struts2 jQuery Grid editoptions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Regarding dataUrl in Struts2 jQuery Grid editoptions" Watch "Regarding dataUrl in Struts2 jQuery Grid editoptions" New topic
Author

Regarding dataUrl in Struts2 jQuery Grid editoptions

arun sankar m
Greenhorn

Joined: Jan 04, 2012
Posts: 3
Hi all,

I need to implement a cascading select for listing country and state in the grid. I have implemented it as shown below

<sjg:gridColumn
name="country.countryName"
index="countryCode"
title="Country Name"
width="200"
sortable="true"
editable="true"
search="true"
surl="%{selectcountrysurl}"
searchoptions="{sopt:['eq','ne'], dataUrl : '%{selectcountryurl}'}"
searchtype="select"
edittype="select"
editoptions="{ dataUrl : '%{selectcountryurl}' ,
dataEvents: [
{ type: 'change',
fn: function(value) {

var params = 'selectedCountry='+this.value;
$.get('get-state-list.action?'+params, function(data) {
var stateDropDown = document.getElementById('stateName');
stateDropDown.innerHTML = data;
});

}
}
] }"
/>

<sjg:gridColumn
name="stateName"
index="stateName"
title="State Name"
width="200"
sortable="true"
editable="true"
search="true"
surl="%{selectstateurl}"
searchoptions="{sopt:['eq','ne'], dataUrl : '%{selectstateurl}'}"
searchtype="select"
edittype="select"
id="stateSelect"
editoptions="{ dataUrl : '%{selectstateurl}' }"
/>



I need to implement a cascading select for listing country and state in the grid. I have implemented it as shown below

<sjg:gridColumn
name="country.countryName"
index="countryCode"
title="Country Name"
width="200"
sortable="true"
editable="true"
search="true"
surl="%{selectcountrysurl}"
searchoptions="{sopt:['eq','ne'], dataUrl : '%{selectcountryurl}'}"
searchtype="select"
edittype="select"
editoptions="{ dataUrl : '%{selectcountryurl}' ,
dataEvents: [
{ type: 'change',
fn: function(value) {

var params = 'selectedCountry='+this.value;
$.get('get-state-list.action?'+params, function(data) {
var stateDropDown = document.getElementById('stateName');
stateDropDown.innerHTML = data;
});

}
}
] }"
/>

<sjg:gridColumn
name="stateName"
index="stateName"
title="State Name"
width="200"
sortable="true"
editable="true"
search="true"
surl="%{selectstateurl}"
searchoptions="{sopt:['eq','ne'], dataUrl : '%{selectstateurl}'}"
searchtype="select"
edittype="select"
id="stateSelect"
editoptions="{ dataUrl : '%{selectstateurl}' }"
/>

With these settings, I could populate the state select box corresponding to the selected country. But upon editing a row using form edit, I could see that the state select box is populated with already existing list as there is no call being made to the dataUrl. I could see that the AJAX request to dataUrl is called only once when the element is created. Is there anyway I can make this possible?

regards, Arun
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding dataUrl in Struts2 jQuery Grid editoptions
 
Similar Threads
Struts2Jquery deleting row in a grid
[Jqueryplugin] [struts2] rendering grid
how to display data in JQuery <sj:gridColumn> in encrypted views
Assigning editable attribute of sjg:gridColumn at runtime
struts-jquery-grid-tags and i18n