All Downloads are FREE. Search and download functionalities are using the official Maven repository.

js.molgenis-mobile-data-item-detail.js Maven / Gradle / Ivy

The newest version!
var selectedFeatureHref = null;

$(document).bind("mobileinit", function() {
	$(document).on('pageshow', '#feature-page', window.top.molgenis.onDataItemPageShow);
	$(document).on('pagehide', '#feature-page', window.top.molgenis.onDataItemPageHide);
});

(function($, molgenis) {
	"use strict";
	
	var ns = molgenis;
	var restApi = new ns.RestClient();
	
	ns.onDataItemPageShow = function() {
		if (selectedFeatureHref) {
			restApi.getAsync(selectedFeatureHref, null, function(feature) {
				$('.feature-name').html(feature.Name);
				$('#feature-description').html(feature.description);
				$('#feature-datatype').html(feature.dataType);
			
				if (feature.dataType == 'categorical') {
				
					$('#categories').append('
    '); $("#categories").trigger("create"); var items = []; items.push('
  • Categories
  • '); var q = {q:[{field:'observablefeature_identifier',operator:'EQUALS',value:feature.Identifier}]}; restApi.getAsync('/api/v1/category', {'q': q}, function(categories) { $.each(categories.items, function() { items.push('
  • ' + this.Name + '
  • '); }); $('#categories ul').html(items.join('')).listview('refresh'); }); } }); } else { window.location.href = '/mobile/catalogue'; } } ns.onDataItemPageHide = function() { $('.feature-name').html(' '); $('#feature-description').html(''); $('#feature-datatype').html(''); $('#categories').html(''); } }($, window.top.molgenis = window.top.molgenis || {}));




    © 2015 - 2025 Weber Informatics LLC | Privacy Policy