How to order items

When dividing the .items file into several .items files, the order in which the items appear in Basic UI and Clasic UI varies from the order that is set.
I have noticed that the last .items file that you modify, places it in last place in both Basic and Clasic UI.
Is there any way to set the order in which items are displayed ??

How is your sitemap defined?
Do you display Groups in the sitemap or individual items?

A single .sitemap showing the main frames
Multiple .items files

Sorry for my english the google translator

Well, the order in which items are displayed in the UIs (Basic and/or Classic) is managed mainly in the sitemap file.

Within the sitemap file, you can list your stuff. I usually use a mix of Groups and individual items.
The sorting of the Group members is coming from the items file.

So: If you want to have full control on how stuff are sorted in your sitemap, use individual item entries and sort them manually.

I hope that I explained it correctly :slight_smile:

The entries in .sitemap, are correct and ordered by frames, there is no problem in the orderly visualization.
When it shows in subscreen the items belonging to it, it is when they are disordered, they maintain an order and it is the last modified .items, it is placed at the end of the sub-screen.

Main screen calls room child
Child room has several .items
temperature

light

humidity

etc

Each parameter is in a file.items that contains all the rooms
When modifying any of the .items files is placed at the end of the screen.

example

If I modify the file temperatura.items
The order of appearance in the child’s room would be:

light

humidity

etc

temperature

I would be best if you can post your sitemap config.

From what I understand, you are using Groups in your sitemap and your various items (distributed across many items files) are members of those Groups.

To control the sorting in this case (and avoid the placement at the end of the most updated group members), you would have to define manually the sitemap config… or place your items in less files.

Another way would be to use subgroups in the Groups.items file and sort them there

Example (Groups.items):

Group	gAll
Group	gGF		(gAll)
Group	gGF_Child_Room (gGF)
Group	gTemp (gAll)
Group	gLights (gAll)
Group	gHumid (gAll)

In theory, when you use gGF_Child_Room (or gGF or gAll) in your sitemap, it should show Temp, then Lights and then Humidity items as sorted above.

My intention was to have the maximum structured, with the minimum code.
For what I understand, the simplest thing is when I finish creating all the .items files, is to leave them sorted. That is, open, edit and save, in the order I want them to appear.
I think it will generate a .bat file that does it automatically, perhaps it is the simplest.
Thanks for your time and help

Sorry it does not translate correctly, this is my sitemap
When I have the items running, I create a .tems file and I move it there

indent preformatted text by 4 spaces
sitemap demo label=" TDR i d'Investigació  --  Casa intel·ligent amb un sistema domòtic"
{
	Frame {
		Group item=gFF label="Zona Silenci" icon="silenci"
		Group item=gGF label="Zona Habitatge" icon="vida"
		Group item=gC label="Zona Magatzem" icon="magatzem"
		Group item=Garden label="JardĂ­" icon="garden"
	}
	
	Frame label="El Temps" {
		
		Text item=Weather_Temperature {//valuecolor=[Weather_LastUpdate=="NULL"="lightgray",Weather_LastUpdate>90="lightgray",>25="orange",>15="green",>5="orange",<=5="blue"] 
			Frame {
				Text item=Weather_Temperature	valuecolor=[>25="orange",>15="green",>5="orange",<=5="blue"]
				Text item=Weather_Temp_Max		valuecolor=[>25="orange",>15="green",>5="orange",<=5="blue"]
				Text item=Weather_Temp_Min		valuecolor=[>25="orange",>15="green",>5="orange",<=5="blue"]
				Text item=Humidity
				Text item=Weather_Pressure
				Text item=Weather_LastUpdate //visibility=[Weather_LastUpdate>10] valuecolor=[Weather_LastUpdate>120="orange", Weather_LastUpdate>300="red"]

			}
			Frame {
				Switch item=Weather_Chart_Period label="GRĂ€FIC" mappings=[0="Hores", 1="Dia", 2="Setmana"]
				Chart item=Weather_Chart period=h refresh=600  visibility=[Weather_Chart_Period==0, Weather_Chart_Period=="NULL"]
				Chart item=Weather_Chart period=D refresh=3600 visibility=[Weather_Chart_Period==1]
				Chart item=Weather_Chart period=W refresh=3600 visibility=[Weather_Chart_Period==2]
			}
		}
        Text label="DADES ASTRONĂ’MIQUES" icon="sun" {
            Text item=Sun_Elevation
            Text item=Sun_Azimuth
            Text item=Sunrise_Time 
            Text item=Sunset_Time
            Text item=Moon_Elevation
            Text item=Moon_Azimuth
        }
	}

    Frame label="General" {
		Text item=CurrentDate
		Text label="Estat General" icon="status" {
			Switch item=Lights mappings=[OFF="Tancar"] icon="light"
			Group item=Heating
			Group item=Windows
			Switch item=Persiana mappings=[DOWN="Baixar"] icon="Rollershutter"
			Text  item=Temperature
		Text  label="Estat de les bateries"	icon="bateria"	{
			Text  label="_______________HabitaciĂł de la Teresa "	icon="girl_2"
			Text item=bateria_FF_Bed_TH 		label="Temperatura"
			Text item=bateria_FF_Bed_Finestra	label="Finestra" 
			Text item=bateria_FF_Bed_pir		label="Presencia" 
			
			Text  label="_______________HabitaciĂł de David "		icon="boy_3"
			Text item=bateria_FF_Bed2_TH		label="Temperatura"
			Text item=bateria_FF_Bed2_Finestra	label="Finestra" 
			Text item=bateria_FF_Bed2_pir		label="Presencia"   
			
			Text  label="_______________HabitaciĂł dels pares "		icon="parents_1_3"
			Text item=bateria_FF_Bed3_TH		label="Temperatura "
			Text item=bateria_FF_Bed3_Finestra	label="Finestra" 
			Text item=bateria_FF_Bed3_pir		label="Presencia"
			
			Text  label="_______________Oficina "					icon="office"
			Text item=bateria_FF_Office_TH		label="Temperatura "
			Text item=bateria_FF_Office_Finestra label="Finestra" 
			Text item=bateria_FF_Office_pir 	label="Presencia"  
		}	// 
		}
		
		Text label="Temperaturas de Consigna" icon="temperature" {	
			Frame label="Histèresis" {
				Setpoint item=set_Histeresis  			label="Histèresis"			icon="temperature"		step=0.5 minValue=0 maxValue=10
				Setpoint item=set_Diposit_inercia  	    label="Diposit d'inèrcia"	icon="temperature"		step=0.5 minValue=0 maxValue=70
			}
			Frame label="Consigna Temperaturas" {
				Setpoint item=set_Bany  				label="Bany"				icon="temperature"		step=0.5 minValue=10 maxValue=25
				Setpoint item=set_Oficina				label="Oficina"				icon="temperature"		step=0.5 minValue=10 maxValue=35
				Setpoint item=set_Dormitori_Teresa  	label="Dormitori Teresa"	icon="temperature"		step=0.5 minValue=10 maxValue=35
				Setpoint item=set_Dormitori_David  		label="Dormitori David"		icon="temperature"		step=0.5 minValue=10 maxValue=35
				Setpoint item=set_Dormitori_Pares 		label="Dormitori Pares"		icon="temperature"		step=0.5 minValue=10 maxValue=35
				Setpoint item=set_Passadis 				label="Passadis"			icon="temperature"		step=0.5 minValue=10 maxValue=25
				Setpoint item=set_Sala_Estar			label="Sala d'Estar"		icon="temperature"		step=0.5 minValue=10 maxValue=25
				Setpoint item=set_Cuina  				label="Cuina"				icon="temperature"		step=0.5 minValue=10 maxValue=25
				Setpoint item=set_Lavabo  				label="Lavabo"				icon="temperature"		step=0.5 minValue=10 maxValue=25
				Setpoint item=set_Rebedor  				label="Rebedor"				icon="temperature"		step=0.5 minValue=10 maxValue=25
			}
			
		}
		Text label="Preus energia " icon="temperature" {	
			Frame label="Preus en c€/kWh " {
				Setpoint item=set_gasoil  			label="Gasoil"			icon="temperature"		step=0.01 minValue=0 maxValue=15
				Setpoint item=set_electricitat  	label="Electricitat"	icon="temperature"		step=0.01 minValue=0 maxValue=15
				Setpoint item=set_gas			  	label="Gas Natural"		icon="temperature"		step=0.01 minValue=0 maxValue=15
				Setpoint item=set_pellet		  	label="Pellet"			icon="temperature"		step=0.01 minValue=0 maxValue=15
			}
			
			
		}		

		Text label="CĂ meres de seguretat" icon="camera" {
			Frame label="CĂ meres de seguretat" icon="camera"{
				Text item=camera1	label="CĂ mera exterior"	icon="camera_ext"      {
 			Webview url="http://***.***.org:81/image/Cam1?q=50&s=50" height=16
muestra foto
time=20817"  height=14 //encoding="mjpeg" ///bcs/channel0_main.bcs?channel=0&stream=0&user={id}&password={pw}
				} 				
				Text item=camera2	label="CĂ mera magatzem"	icon="camera"	{
 			Webview url="http://**********:81/login.htm?page=%2Fimage%2FCam1" 
				} 				  
				Text item=camera3	label="CĂ mera jardĂ­"	icon="camera_ext" {
 			Webview url="http://*******:81/login.htm?page=%2Fimage%2FCam1"
				} 				  
				Text item=camera4	label="CĂ mera passadĂ­s"	icon="camera"{
 			Webview url="http://********:81/login.htm?page=%2Fimage%2FCam1"
				} 				  
				Text item=camera5	label="CĂ mera menjador"	icon="camera"{
 			Webview url="http://******.org:81/login.htm?page=%2Fimage%2FCam1"
				} 				  
				Text item=camera6	label="CĂ mera entrada"	icon="camera"{
 			Webview url="http:/*******.org:81/login.htm?page=%2Fimage%2FCam1"
				} 				  
							
			}
			Frame label="Map/Location" {
//				Mapview item=DemoLocation height=10
			}

		Text label="Preséncia de mòbils a casa" icon="icomovil"	{
			Frame label="Mòbils detectats dins de casa" icon="icomovil"{
				//Switch  Phone_Mobile	"My Mobile Phone"	{ channel="mxavier:online" }
				//Text item=192_168_1_52 label="Device [%s]"
				Switch item=mteresa label="Mòbil Teresa"	icon="icomovil" 	mappings=[ON="SI",OFF="NO"]
				Switch item=mdavid  label="Mòbil David"		icon="icomovil" 	mappings=[ON="SI",OFF="NO"]
				Switch item=txavier label="Tablet Xavier"	icon="icomovil" 	mappings=[ON="SI",OFF="NO"]	
				Switch item=mxavier label="Mòbil Xavier"	icon="icomovil" 	mappings=[ON="SI",OFF="NO"]	//	{ network:device:192_168_1_52:online }
				Switch item=mmontse label="Mòbil Montse"	icon="icomovil" 	mappings=[ON="SI",OFF="NO"]	
				Switch item=mlladre label="Presència ALIENA" icon="ladron" 	    mappings=[ON="SI",OFF="NO"]
			}

		}
		

	
	}
	Text label= "IP"	icon=""
	Frame {
		Text item=Network_WAN_IP
	}
//	Text label= "CALENDARI"
//		Frame label="CALENDARI" {
//		Webview url="/static/GoogleCalendar.html" height=11
//		Webview url="https://calendar.google.com/calendar/render#main_7" height=11
//		Webview url="https://www.google.com/calendar?tab=cc&authuser=0" height=11
//	}

You have no control over the order of items when you use Group on your sitemap.

If you care about ordering of your items, or if you want to customize how an item appears (e.g. Show a Switch without the toggle control icon, change the color of a label based on its state, etc) you must put each item on your sitemap individually.

No other approach will guarantee the order of how the others appear.

4 Likes