DataPrid의 외부 플러그인을 사용하고 있습니다. json 객체를 외부 플러그인에 전달해야합니다.외부 플러그인에 데이터를 제공하기 위해 모델에 액세스하는 방법은 무엇입니까?
데이터를 수집하기 위해 모델에 액세스하려고 할 때 (json 객체) 클래스가 객체가 아니기 때문에 아무 것도 일어나지 않습니다.
라우터 :
Grid.Router.map(function() {
this.resource('mainview', { path: '/' });
this.resource("modal", function(){
this.route("new", {path:"/new"});
this.route("edit", {path: "/:contact_id" });
});
});
Grid.MainviewRoute = Ember.Route.extend({
model: function() {
return Grid.ModalModel.find();
}
});
Grid.GriddataRoute = Ember.Route.extend({
model: function() {
return Grid.ModalModel.find();
}
});
Model.js :
Grid.ModalModel = DS.Model.extend({
fname: DS.attr('string'),
lname: DS.attr('string'),
email: DS.attr('string'),
contactno: DS.attr('string'),
gendertype: DS.attr('boolean'),
contactype: DS.attr('number')
});
Grid.ModalModel.FIXTURES = [
{
id: 1,
fname: "ghg",
lname: "gh",
email: "gh",
contactno: "4542154",
gendertype: true,
contactype: 1,
action1:"",
action2:""
},
{
id: 2,
fname: "ghg",
lname: "gh",
email: "gh",
contactno: "4542154",
gendertype: true,
contactype: 1,
action1:"",
action2:""
},
{
id: 3,
fname: "ghg",
lname: "gh",
email: "gh",
contactno: "4542154",
gendertype: true,
contactype: 1,
action1:"",
action2:""
}
];
Store.js :
Grid.Store = DS.Store.extend({
revision: 11,
adapter: 'DS.FixtureAdapter'
});
컨트롤러 :
내가 여기에 내 코드를 나열했습니다
return Grid.ModalModel.find();
여기 뷰는 컨트롤러에서 데이터에 액세스합니다. 뷰 (didInsertElement)에서 외부 DataGrid 함수를 호출하고 데이터를이 함수의 인수로 전달하고 있습니다. 내가 무엇입니까 return this.get('controller.model')
를 사용하는 경우
내가 클래스를 얻고 Grid.ModalModel.find()
를 사용하여 데이터에 액세스하려고하는 경우는 (CONSOLE.LOG에서 다음 데이터를 참조)
Class {type: function, store: Class, isLoaded: true, isUpdating: true, toString: function…}
:
나는 다음과 같은 문제를 얻고있다
: 나는 다음과 같은 오류를 얻고 객체를 JSON으로Grid.ModalModel.find()
변환하려고
undefined
Uncaught TypeError: Converting circular structure to JSON
json 객체 형식으로 데이터를 가져 오기 위해 여기 모델에 액세스하는 방법을 알려 줄 사람이 있습니까?
내가 Uncaught TypeError: Object [object Object] has no method 'toJSON'
어떻게 Grid.ModalModel.find()를 JSON으로 변환하려고합니까? – intuitivepixel