-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: My script is not running after jSon data is returned
PostPosted: Thu Jul 01, 2010 8:38 pm 
Newbie

Joined: Thu Jun 03, 2010 8:30 pm
Posts: 4
Could NHibernate cause such problem below? I have a manyTomany relationship for the 2 tables. Does this declaration looks about right? Thank you.
public class ResearchInterestMap : ClassMap<ResearchInterest>
{
public ResearchInterestMap()
{
WithTable("ResearchInterests");
Id(x => x.Id);
Map(x => x.Name);
References(x => x.ParentResearchInterest);
HasManyToMany(x => x.applications).AsBag().WithTableName(
"ApplicationResearchInterests").WithParentKeyColumn("ResearchInterestId").WithChildKeyColumn(
"ApplicationId").Cascade.All();
}
}

public ApplicationMap()
{
WithTable("Applications");
Id(x => x.Id);
Map(x => x.FirstName);
Map(x => x.LastName);
Map(x => x.EmailAddress);
Map(x => x.PhoneNumber);
Map(x => x.MailingAddressLine1);
Map(x => x.MailingAddressLine2);
Map(x => x.MailingAddressCity);
Map(x => x.MailingAddressState);
Map(x => x.MailingAddressZip);
Map(x => x.Institution);
Map(x => x.InstitutionOther);
Map(x => x.CommunityOrganization);
References(x => x.Title);
Map(x => x.TitleOther);
Map(x => x.Department);
Map(x => x.ProfessionalOrganizations);
Map(x => x.MembershipLevel);
Map(x => x.MembershipReasonOther);
Map(x => x.PhdTraineeCount);
Map(x => x.MscTraineeCount);
Map(x => x.Gender);
Map(x => x.YearOfBirth);
Map(x => x.Race);
Map(x => x.RaceOther);
Map(x => x.Ethnicity);

HasManyToMany(x => x.ResearchInterests).AsBag().WithTableName(
"ApplicationResearchInterests").WithParentKeyColumn("ApplicationId").WithChildKeyColumn(
"ResearchInterestId").Inverse();

HasManyToMany<Degree>(x => x.Degrees).AsBag().WithTableName("ApplicationDegrees").WithParentKeyColumn(
"ApplicationId").WithChildKeyColumn("DegreeId");
HasManyToMany<MembershipReason>(x => x.MembershipReasons).AsBag().WithTableName(
"ApplicationMembershipReasons").WithParentKeyColumn("ApplicationId").WithChildKeyColumn(
"MembershipReasonId");
HasManyToMany<MembershipServiceRequirement>(x => x.MembershipServiceRequirements).AsBag().WithTableName(
"ApplicationMembershipServiceRequirements").WithParentKeyColumn("ApplicationId").WithChildKeyColumn(
"MembershipServiceRequirementId");
}


Hi, I'm using V.S. 2008, .net 3.5, NHibernate 2.0. You can see the page at http://www.labctsi.org/Members/SearchMembers.aspx/Index

After my $.getJSON call to retrieve data, I can see many records are retrieved in my debug mode in the "result". As I step through the code after the "return this.Json(result);", (This is is in my controller file)

public JsonResult GetChildResearchInterests(long id)
{
var result = ResearchInterestRepository.FindByParentResearchInterestId(id);
return this.Json(result);
}

it went into the Application constructor code,

public Application()
{
ResearchInterests = new List<ResearchInterest>();
Degrees = new List<Degree>();
MembershipReasons = new List<MembershipReason>();
MembershipServiceRequirements = new List<MembershipServiceRequirement>();
}

after which I click the Continue arrow then nothing happens. The script on my View side is supposed to construct a 2nd Select control based on the data retrieved but nothing happens. In Firebug, no script is run and no error is reported. how can I find out what happened here and how to fix this? Also, why was the Application constructor code being stepped though? Thank you.

$("#level1ResearchInterests").change(function() {
$.getJSON("/SearchMembers.aspx/GetChildResearchInterests/" + $(this).val(), Populate);
$('#level3ResearchInterests').fadeOut('fast');
$('#level4ResearchInterests').fadeOut('fast');
});

function Populate(json) {
alert("1st result : " + json[0].Name);
if (json.length <= 0)
alert("Nothing returned");
else
alert("results returned = " + json.length);


var options = '';
for (var i = 0; i < json.length; i++) {
options += '<option value="' + json[i].Id + '">' + json[i].Name + '</option>';
}

$("#level2ResearchInterests").html(options);
$("#level3ResearchInterests").html('');
$("#level4ResearchInterests").html('');
if (json.length > 0) {
$('#level1ResearchInterests').animate({ width: 170 }, 'fast', function() {
$('#level2ResearchInterests').css('width', '340px');
$('#level2ResearchInterests').fadeIn('fast');
})
}
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.