Page 1 of 1

[WebApp] Sweep bei einer Liste

Posted: Tue 26. Jun 2012, 08:44
by sCion
Ich möchte gerne Sweep zu einer Liste hinzufügen, aber leider funktioniert das nicht

Ohne ContextItem funktioniert alles prima, allerdings kein Sweep. Für Sweep brauch ich nämlich ContextItems.

Code: Select all

this.folderList = new Osp.Ui.Controls.List({
				bounds: {x: 0, y: 60, width: 480, height: 554},
				itemDivider: true,
				fastScroll: false
			});			
			
			this.folderList.setBackgroundColor(this.STYLE.BACKGROUND.FORM);
			this.folderList.setItemDividerColor(this.STYLE.ITEM.COLOR.DIVIDER);
			this.folderList.setTextOfEmptyList(this.LANG.NOFOLDERS);
			this.folderList.setTextColorOfEmptyList(this.STYLE.LABEL.COLOR.NORMAL);
			this.folderList.setSweepEnabled(true);
			
			var folderListObj = JSON.parse(localStorage.getItem("fld_complete"));
			var rspObject = folderListObj.results;
			for (var i = 0; i < rspObject.length; i++)
			{
				var gotFolderDetails = rspObject[i];
				var tempItem = this.getFolderItem(gotFolderDetails.name, gotFolderDetails.id, gotFolderDetails.file_count, gotFolderDetails.thumbnail_url, gotFolderDetails.is_public, gotFolderDetails.date_last_updated, gotFolderDetails.view_count);
				this.folderList.addItem(tempItem);
			}

getFolderItem: function(name, id, count, thumbnail, status, lastupdate, views) {
			var item =
			{
					height: 90,
					setting:
					{
						backgroundColor:
						{
							normal: '#FFFFFF',
							pressed: '#EDEDED'
						},
						descriptionText : "updated: "+lastupdate+" | views: "+views, 
					    descriptionTextColor : "#FFA500",
						annex: Osp.Ui.Controls.ListAnnexStyle.NORMAL,
						elements: [],
						listContextItem: []
					}   
			};
			
			var checkURL = Osp.Core.Check.isUrl(thumbnail);
			if(checkURL == false)
			{
				var oldThumb = thumbnail;
				var wrongString = new RegExp(["//dgbc7tshfzi70.cloudfront.net/smedia/"]);
				var fixedString = "http://dgbc7tshfzi70.cloudfront.net/smedia/";
				var validUrl=Osp.Core.StringHelper.replace(oldThumb,wrongString,fixedString);
				
				localStorage.setItem("thumbnail", validUrl);
			}
			else
			{
				localStorage.setItem("thumbnail", thumbnail);
			}
			
			if(status == false)
			{
				var isPublic = " *";
			}
			else
			{
				var isPublic = "";
			}
			item.setting.elements.push({
				bounds: {x: 0, y: 0, width: 90, height: 90},
				image:
				{
					normal:
					{
						src: localStorage.getItem("thumbnail"),
						bounds: {x: 5, y: 5, width: 80, height: 80}
					},
					pressed:
					{
						src: localStorage.getItem("thumbnail"),
						bounds: {x: 5, y: 5, width: 80, height: 80}
					}
				}
			});
			
			item.setting.elements.push({
				text: name+" ("+count+")"+isPublic,
				textSize: 30,
				textColor: {
					normal: '#000000',
					pressed: '#000000'
				},
				textSliding: false
			});
			
			item.setting.listContextItem.push({
				backgroundColor: "#EDEDED",
		        contextItemElements: [{bounds:{x: 5, y: 5, width: 235, height: 30}, enable: true, image:{normal:{src:this.IMG.IMG_PATH+"editFolder.png", bounds:{x: 102, y: 0, width: 30, height: 30}}, pressed:{src:this.IMG.IMG_PATH+"editFolder_pressed.png", bounds:{x: 102, y: 0, width: 30, height: 30}}}}, {bounds:{x: 235, y: 5, width: 235, height: 30}, enable: true, image:{normal:{src:this.IMG.IMG_PATH+"deleteFolder.png", bounds:{x: 102, y: 0, width: 30, height: 30}}, pressed:{src:this.IMG.IMG_PATH+"deleteFolder_pressed.png", bounds:{x: 102, y: 0, width: 30, height: 30}}}}]
		    });
			
			return item;
		}
Als Fehler-Meldung spuckt mir das SDK folgendes aus:
0156.308,INFO,P32,T00,A125,Osp::Web::Controls::__WebService::AddMessageToConsole (3938) > [hydra] - ERROR - List::__validateItemSetting --> Invalid listContextItem.contextItemElements at line 1 loaded from file
0156.314,INFO,P32,T00,A125,Osp::Web::Controls::__WebService::AddMessageToConsole (3938) > [hydra] - ERROR - List::__validateItemSetting --> Invalid elements in config.setting.listContextItem . at line 1 loaded from file
0156.317,INFO,P32,T00,A125,Osp::Web::Controls::__WebService::AddMessageToConsole (3938) > [hydra] - ERROR - List::addItem --> invalid 'config' as argument. at line 1 loaded from file
0156.325,INFO,P32,T00,A125,Osp::Web::Controls::__WebService::AddMessageToConsole (3938) > [hydra] - ERROR - List::__validateItemSetting --> Invalid listContextItem.contextItemElements at line 1 loaded from file
0156.328,INFO,P32,T00,A125,Osp::Web::Controls::__WebService::AddMessageToConsole (3938) > [hydra] - ERROR - List::__validateItemSetting --> Invalid elements in config.setting.listContextItem . at line 1 loaded from file
0156.331,INFO,P32,T00,A125,Osp::Web::Controls::__WebService::AddMessageToConsole (3938) > [hydra] - ERROR - List::addItem --> invalid 'config' as argument. at line 1 loaded from file
0156.338,INFO,P32,T00,A125,Osp::Web::Controls::__WebService::AddMessageToConsole (3938) > [hydra] - ERROR - List::__validateItemSetting --> Invalid listContextItem.contextItemElements at line 1 loaded from file
0156.341,INFO,P32,T00,A125,Osp::Web::Controls::__WebService::AddMessageToConsole (3938) > [hydra] - ERROR - List::__validateItemSetting --> Invalid elements in config.setting.listContextItem . at line 1 loaded from file
0156.344,INFO,P32,T00,A125,Osp::Web::Controls::__WebService::AddMessageToConsole (3938) > [hydra] - ERROR - List::addItem --> invalid 'config' as argument. at line 1 loaded from file
0156.351,INFO,P32,T00,A125,Osp::Web::Controls::__WebService::AddMessageToConsole (3938) > [hydra] - ERROR - List::__validateItemSetting --> Invalid listContextItem.contextItemElements at line 1 loaded from file
0156.354,INFO,P32,T00,A125,Osp::Web::Controls::__WebService::AddMessageToConsole (3938) > [hydra] - ERROR - List::__validateItemSetting --> Invalid elements in config.setting.listContextItem . at line 1 loaded from file
0156.358,INFO,P32,T00,A125,Osp::Web::Controls::__WebService::AddMessageToConsole (3938) > [hydra] - ERROR - List::addItem --> invalid 'config' as argument. at line 1 loaded from file

Re: [WebApp] Sweep bei einer Liste

Posted: Wed 27. Jun 2012, 11:21
by sCion
ok den Teil mit der Fehlermeldung habe ich wohl hinbekommen... Das Attribut heißt wohl contextItem und nicht listContextItem (zu mindestens wird es jetzt generiert ohne Fehler)

Allerdings habe ich noch Problem mit der Einbindung des SweepControls und Sweepen geht allgemein noch nicht.