Skip to content

HWA-Search - Add property to template #4

@sxndy1

Description

@sxndy1

Hey guys,

I'm using only the HWA-Search of your project and it works like a charm! So first of all, thank you for this!

I would like to add a property to the template for list items.

function loadHardwareSearch() {

	customSearchHardwareAsset = {

		// Init code of search box 
		initSearch: function (searchInput) {
		
			// Create datasource
			var dataSource = customSearchLib.initDataSource(this.initCriteria);

			// Set Template for list items
			var template = '<div class="k-item k-widget k-state-default "><span class="k-item" style="padding-left: 0px;"><b>Name:</b> #: data.Name # </br><b>ID:</b> #: data.HardwareAssetID # </br><b>Serial:</b> #: data.SerialNumber # </br></div>';

			// enableCustomSearch
			customSearchLib.enableCustomSearch(searchInput, template, this.onSelect, dataSource);
		},

		// Criteria init code
		initCriteria: function (options) {
					
			(..)
		},
		
		onSelect: function (event,dataItem) {

			(..)
		}
	};
	app.events.publish('customSearchHardwareAssetCreated');
}

There are no changes in code (HardwareAssetSearch.js). Only in the template-string.

As you can see i tried to add the HWA-ID to the template. But when I'm doing this, no matter which property of an HWA I take, it will show me always the value "undefined".

image

Is it somehow possible to do something like that?

Cheers
Daniel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions