listview order

Benutzeravatar
ounos
Member
Beiträge: 44
Registriert: Mi 6. Aug 2014, 11:09

listview order

Beitragvon ounos » Mo 24. Aug 2015, 12:32

I added a new field in a template (<we:select>). This new field is included in the order fields of a listview.
Of course, there are a lot of existing documents based on this template.
Is it possible to update (not manually of course) all these documents' new field with a default value, so that I can order them properly ?
Now, the value of this field is empty (I guess) for existing documents and they are not even displayed in the listview.

Thank you in advance.

WBTMagnum
webEdition Partner
webEdition Partner
Beiträge: 1825
Registriert: Di 7. Mär 2006, 16:50
Wohnort: Wien
Kontaktdaten:

Re: listview order

Beitragvon WBTMagnum » Mo 24. Aug 2015, 12:49

Hi,
  1. In Editmode: Check if the value is set. If not, set the attribute "selected" for the default option.
  2. In NotEditmode: Check if the value is set. If not, apply your default value as a fallback.
HTH,
Sascha

Benutzeravatar
ounos
Member
Beiträge: 44
Registriert: Mi 6. Aug 2014, 11:09

Re: listview order

Beitragvon ounos » Di 25. Aug 2015, 11:05

To whom it may be interested, I had to create a new template and use it as a script in order to bulk update existing documents:

Code: Alles auswählen

<we:listview name="myListview" type="document" doctype="myDoctype">
	<we:repeat>
		<we:field name="WE_ID" to="global" nameto="docID"/>
<?php
		$doc = new we_webEditionDocument();
		$doc->initByID($GLOBALS['docID']);
		$doc->setElement('myElement', 'myValue');
		$doc->we_save();
		$doc->we_publish();
?>
	</we:repeat>
</we:listview>


Zurück zu „webEdition Basic Version“

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 10 Gäste