Get ready for BLACK FRIDAY shopping starting in

HTML5 Data Bindings Formatter Support Product Page

Answered

Default detail region with group by

Asked 30 Mar 2014 20:28:52
1
has this question
30 Mar 2014 20:28:52 Marcel Haag posted:
I would like to know how I can change the default value for the detail region with a group by setup.

<div class="row-fluid">
  <div class="span6">
    <div data-binding-id="repeat1" data-binding-repeat="{{mitarbeiter.data.groupBy( &quot;name_pos&quot; )}}">
      [h5]{{$name}}[/h5][list]
        <div data-binding-id="repeat2" data-binding-repeat="{{$value}}">
          <li onClick="dmxDataBindingsAction('selectCurrent','repeat2',this)"><a href="#">{{VORNAME}} {{NAME}}</a>[/*]
        </div>[/list]
    </div>
  </div>
  <div class="span6" id="mitarbeiter_det" data-binding-detail="repeat2" data-binding-id="mitarbeiter_det">[img]" alt="" class="aligncenter" data-binding-src="../../../assets/bilder_ma/{{BILD}}" />
    <h5 class="tighten-height">{{VORNAME}} {{NAME}}[/h5]
  </div>
</div>


At the moment I get the first value of repeat2 in the last group of repeat1. I would like to have the first value of repeat2 in the first group of repeat1 as default (mitarbeiter.data[0]).

How can I do this?

Replies

Replied 01 Apr 2014 06:51:16
01 Apr 2014 06:51:16 Marcel Haag replied:
I hope you understand the problem I have. Any idea?
Replied 01 Apr 2014 09:21:56
01 Apr 2014 09:21:56 Teodor Kuduschiev replied:
Hello Marcel,
Using such a layout this is not possible. This happens because the repeat region "repeat2" exists multiple times, it is nested in the "repeat1". So it overwrites the previous repeat regions and the first record from the last "repeat" region is shown in the detail.
Replied 01 Apr 2014 09:29:36
01 Apr 2014 09:29:36 Marcel Haag replied:
Hello Teodor,
I understand the problem, but shouldn't it be possible to use mitarbeiter.data[0] as default?
Is there a solution with show/hide?
Could I show a region with mitarbeiter.data.[0] as default and hide the default region on load?
Replied 01 Apr 2014 09:49:12
01 Apr 2014 09:49:12 Teodor Kuduschiev replied:
You can create 2 detail regions:

<div data-binding-id="detail2" data-binding-detail="repeat2">
{{mitarbeiter.data.[0].VORNAME}} {{mitarbeiter.data.[0].NAME}}
</div>

And
<div data-binding-id="detail1" data-binding-detail="repeat2">
{{VORNAME}} {{NAME}}
</div>

The first one will always show the first record, and the second one will show the selected record. You can add display:none to the second one so it is hidden by default.
Then on click behavior you can hide the first and show the second.
Replied 01 Apr 2014 12:39:22
01 Apr 2014 12:39:22 Marcel Haag replied:
That is what I was looking for. Thanks a lot.
I found out that the detail region for the first record does not need the data-binding-detail="repeat2"
Replied 03 Apr 2014 15:21:35
03 Apr 2014 15:21:35 Marcel Haag replied:
Hello Teodor,
I have an additional question on this topic.
The problem now is, that on the first click on a name you can see the default image of the last repeat for <1s before the correct image is shown. It seems to flicker.

Any idea how to solve this?

Reply to this topic