I have created my model assets and controller, including previews for entities like users and organizations. However, when I attempt to use global search without first loading these entities by opening them in the controller , it does not work, and I receive errors. Although all relationships exist and everything functions correctly when not using global search, the issue persists specifically with the global search feature.
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::name', display: __('Organization'), tag: 'autocompletion_ajax_customer_organization', multiple: false, null: false, relation: 'Organization', },
{ name: 'user::firstname', display: __('User'), tag: 'autocompletion_ajax', relation: 'User', null: true, },
{ name: 'invoice_present', display: __('Faktura'), tag: 'input', null: false, },
{ name: 'attachments_count', display: __('Załączniki'), tag: 'input',null: true, },
{ name: 'model', display: __('Aktywo'), tag: 'autocompletion_ajax', relation: 'Model', null: true, },
{ name: 'seller', 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::name', 'user::firstname', 'invoice', 'files', 'model_id', 'seller_id', 'purchase_date', 'purchase_cost', 'description'
]
@configure_preview = [
'name', 'serial_number', 'organization::name', 'user::firstname', 'invoice', 'files', 'model_id', 'seller_id', 'purchase_date', 'purchase_cost', 'description'
]
icon: ->
'overviews'
uiUrl: ->
"#manage_assets/preview/asset/#{@id}"
displayName: ->
if !_.isEmpty(@name)
name = @name
searchResultAttributes: =>
display: "#{@displayName()}"
url: @uiUrl()
id: @id
icon: "#{@icon()}"