HTML5 Data Bindings Support Product Page

Answered

detailed region set start record

Asked 25 Aug 2016 15:52:11
1
has this question
25 Aug 2016 15:52:11 Hans Haverlach posted:
I have a repeat region with a detail region.
Normally it always shows the first record.

With a behavioraction and the extended repeater you can tell the script to start with a different record (first - last -next- last etc...)
But I want it to start with a specific record ID with the value from GET.
Is this possible?

Replies

Replied 26 Aug 2016 07:07:52
26 Aug 2016 07:07:52 Teodor Kuduschiev replied:
Replied 26 Aug 2016 08:46:47
26 Aug 2016 08:46:47 Hans Haverlach replied:
Thank you for your answer. That method works ofcourse, but it takes you to another page.

The detail region function was a nice ajax 'without page refresh' function.
I have to write my own ajax function to open this detailpage inside my index page.

No problem, but it will be a nice addition if you somehow could add this functionality to the extended repeater extension so that you can start the detail region data on the same page, based on a URL parameter.

Replied 26 Aug 2016 08:51:46
26 Aug 2016 08:51:46 Teodor Kuduschiev replied:
I believe you can use the {{$URL.varName}} in the start record field in the extended repeater also ...
Replied 26 Aug 2016 10:08:21
26 Aug 2016 10:08:21 Hans Haverlach replied:
I tried that, by editing the repeat1 and that produced this code in the repeat-data-binding:

<div class="small-4 columns" data-binding-repeat="{{ex_zijcontent.data.q_content}}" data-binding-id="repeat1" data-binding-repeat-index="{{$URL.id}}">

But that gives unexpected results. Most of the time still the first record is shown, some times it gives the desired record.
Replied 26 Aug 2016 11:01:22
26 Aug 2016 11:01:22 Teodor Kuduschiev replied:
I just tested locally and it works as expected.

data-binding-repeat-index="{{$URL.id}}" sets the selected record in the detail region. Note that the repeat-index points to the records in the repeat region starting from: 0
So if the id=0 this is the first record in the repeat region, if id=1 this is the second etc..
Replied 26 Aug 2016 12:07:10
26 Aug 2016 12:07:10 Hans Haverlach replied:
Aha, I get it. Yes it does work like that. Great.

I thought it would search for the record ID.
If possible in an update, that would be handier.

Now I have to adapt my link system to generate a link not with the record ID, but with it's position in the dataset.
That is not so convenient.
But thank you for make this clear to me.
Replied 26 Aug 2016 12:17:23
26 Aug 2016 12:17:23 Teodor Kuduschiev replied:
No, it doesn't work with ID ... if you want to filter by ID you must filter your query, and with the help of the states manager you do not even need to refresh the page, when the URL param i changed.

Reply to this topic