Call Widget Function when using DataRepeater

0
0

Hi all.  Hope everyone is well.

Using the following init script,  Im able to call the  “LoadMedia”  function   just fine from a button click event on the Window.

My goal is to be able to call the  “LoadMedia” function for the widget  after adding it to a  DataRepeater, but I’m unable to do the same using any of the   events associated with DataRepeater.

 

I get an error saying “Unknown Function: LoadMedia”

 

Package name = “WaveSurfer.js”

Source = “https://unpkg.com/wavesurfer.js”

 

 

.fctbNone{ color:#000000; }
.fctbStyle0{ color:#2e75b6; }
.fctbStyle1{ color:#a31515; }
.fctbStyle2{ color:#008000;font-style:oblique; }
this.init = function(options) {
    
this.container.id = "waveform";

    // your initialization code.
    var wavesurfer = WaveSurfer.create({
        container: '#waveform',
        waveColor: 'blue',
    progressColor: 'purple'
});

this.LoadMedia = function(value){

    wavesurfer.load(value);
};

}

 

Any suggestions would be appreciated.

 

Thanks

 

  • You must to post comments
0
0

Hi Lennox,

ItemCloned is fired when a new item is created but the new item is NOT the item on the screen. A data repeater with 1000 records and 3 visible items will fire ItemCloned 3 times, not 1000.

When the item is populated it fires ItemUpdate, is your first,
The second step, Wisej loads js packages asynchronously and therefore it is ideal to use this procedure:


//js initialization
this.init = function(options) {
// your initialization code.
this.widget = WaveSurfer.create({
container: '#'+this.getId()+"_container",
waveColor: 'blue',
progressColor: 'purple'
});
'VB Event
Private Sub DataRepeater1_ItemUpdate(sender As Object, e As DataRepeaterItemEventArgs) Handles DataRepeater1.ItemUpdate
Dim Player As Widget = e.DataRepeaterItem.Controls("Widget1")
Player.Instance.load("http://ia902606.us.archive.org/35/items/shortpoetry_047_librivox/song_cjrg_teasdale_64kb.mp3")
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Widget2.Instance.load("http://ia902606.us.archive.org/35/items/shortpoetry_047_librivox/song_cjrg_teasdale_64kb.mp3")
End Sub

Happy Coding,

I attached one sample

Kevin (ITG)

  • Lennox Robinson
    Hello Kevin. Thank you for the prompt reply and excellent code example. The ultimate goal is to have the Data Repeater populated from a Database and call Load function with different mp3 files. I should be able to pass those values along quite easily. Thanks again.
  • You must to post comments
0
0

Please find attached.

 

 

One button simply loads the widget  and call the  “LoadMedia” function by itself.

The other  populates the Repeater and tries to call the function using the  DataRepeater1_ItemCloned() event

 

I had to remove the “Wisej.Framework.dll” to keep the size of the zip file down.

Attachment
  • You must to post comments
0
0

Hi Lennox,

can you please post a complete sample that includes the Data Repeater and where you want to call the widget code?

Thanks in advance.

Best regards
Frank

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.