Seite 1 von 1

listview order

Verfasst: Mo 24. Aug 2015, 12:32
von ounos
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.

Re: listview order

Verfasst: Mo 24. Aug 2015, 12:49
von WBTMagnum
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

Re: listview order

Verfasst: Di 25. Aug 2015, 11:05
von ounos
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>