I managed to solve this problem, but I have another one related to (which is related to this one) my it turned out that I don’t have the function in the @_fillUp model that adds relationships from which later information is extracted (this is done in the user’s model and the organization and it works there ) I did the same thing, however, with my other models and it looks like they are not started in memory because when I call them in another place the relationship works
Now my model looks like this
class App.Asset extends App.Model
@configure 'Asset','form_id', 'name', 'serial_number', 'organization', 'user', 'invoice', 'files', 'model', 'seller', 'purchase_date', 'purchase_cost', 'description'
@extend Spine.Model.Ajax
@url: @apiPath + '/assets'
@configure_attributes = [
{ name: 'name', display: __('Nazwa'), tag: 'input', null: false, },
{ name: 'serial_number', display: __('Numer seryjny'), tag: 'input',null: false },
{ name: 'organization_id', display: __('Organization'), relation: 'Organization'},
{ name: 'user_id', display: __('User'), relation: 'User', width: '12%'},
{ name: 'invoice', display: __('Faktura'), tag: 'file_upload', single: true, null: true, },
{ name: 'files', display: __('Załączniki'), tag: 'file_upload', single: false, null: true, },
{ name: 'model_id', display: __('Aktywo'), relation: 'Model', null: true, },
{ name: 'seller_id', display: __('Sprzedawca'), tag: 'autocompletion_ajax', relation: 'Seller', null: true,},
{ name: 'purchase_date', display: __('Data kupna'), tag: 'date', class: 'input', null: true },
{ name: 'purchase_cost', display: __('Koszt kupna'), tag: 'decimal', null: true},
{ name: 'description', display: __('Opis'), tag: 'textarea',upload:true, class: 'input', null: true},
]
@configure_overview = [
'name', 'serial_number', 'organization', 'user', 'invoice', 'files', 'model', 'seller', 'purchase_date', 'purchase_cost', 'description'
]
@configure_preview = [
'name', 'serial_number', 'organization', 'user', 'invoice', 'files', 'model', 'seller', 'purchase_date', 'purchase_cost', 'description'
]
icon: ->
'overviews'
uiUrl: ->
"#manage_assets/preview/asset/#{@id}"
displayName: ->
if !_.isEmpty(@name)
name = @name
@_fillUp: (data) ->
if data.organization_id
data.organization = App.Organization.findNative(data.organization_id)
console.log data.organization
if data.model_id
data.model = App.Model.findNative(data.model_id)
console.log data.model
if data.seller_id
data.seller = App.Model.findNative(data.seller_id)
console.log data.seller
data
searchResultAttributes: =>
display: "#{@displayName()}"
url: @uiUrl()
id: @id
icon: "#{@icon()}"
the data in the table looks like this
and these are the console.logs from the _fillUp function