Skip to content

type error when moving views #25

@jonbcampos

Description

@jonbcampos

I'm getting

TypeError
get stack: function () { [native code] }
message: "Cannot call method 'split' of undefined"
set stack: function () { [native code] }
__proto__: Error

When I move between other views and my search View. I'm including both of my view and mediator below to see if there is any obvious issue.

the html

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body class="tab-content search">
<h1>Search</h1>
<div>
    <input id="searchInput" placeholder="Search by title..."/>
    <Button id="submitButton">Search</Button>
</div>
<div class="tableFragment"></div>
</body>
</html>

and the mediator

package mediators {
import randori.behaviors.AbstractMediator;
import randori.behaviors.SimpleList;
import randori.jquery.Event;
import randori.jquery.JQuery; 
import randori.webkit.page.Window;

import services.MovieService;

import vos.MovieResultVO;

 /**
 * Created with IntelliJ IDEA.
 * User: jonbcampos
 * Date: 4/30/13
 * Time: 10:35 AM
 * To change this template use File | Settings | File Templates.
 */
public class SearchMediator extends AbstractMediator {

public function SearchMediator() {
}

[Inject]
public var service:MovieService;

[Inject(required="true")]
public var list:SimpleList;

[Inject(required="true")]
public var submitButton:JQuery;

[Inject(required="true")]
public var searchInput:JQuery;

override protected function onRegister():void
{
    submitButton.click(onButtonClickHandler);
}

override protected function onDeregister():void
{

}

private function onButtonClickHandler(event:Event):void
{
    var term:String = searchInput.val();
    service.search(term).then(handleResult, handleFault);
}

private function handleResult(result:MovieResultVO):void
{
    Window.console.log("total: "+result.total.toString());
    list.data = result.movies;
}

private function handleFault(fault:Object):void
{
    Window.console.log(fault.toString());
}

}
}

The fault is thrown on the fault handler of this function (almost identical to the hmss project)

private function menuItemSelected(menuData:MenuItem):void{
    viewStack.popView();
    var promise:Promise = viewStack.pushView(menuData.url);

    promise.then(function(result:AbstractMediator):void{
        Window.console.log(menuData.url);
    }, function(fault:Object):void{
        Window.console.log(fault);
    });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions