Manual Array Guid Support

Posted by Community Admin on 04-Aug-2018 14:03

Manual Array Guid Support

All Replies

Posted by Community Admin on 09-Jul-2012 00:00

If I have a custom control that has a Guid[] field, how can I set that property in a custom designer?  I'm trying to create a clientside array or a JSON string, but neither seem to work

(I suppose I could store as a JSON string and parse that out in the code back to Guid[], but I was hoping there was a built-in direct method?

var selectedForms = [];
        var formBox = $find("formsListBox");
        var items = formBox.get_items();
        for (var i = 0; i < items.get_count(); i++)
           if(formBox.getItem(i).get_selected())
               var item = formBox.getItem(i);
               //Add to array
               selectedForms.push(item.get_value());
           
        
 
        controlData.FormIDs = selectedForms; //Nope
 //       controlData.FormIDs = JSON.stringify(selectedForms); //Nope

Posted by Community Admin on 12-Jul-2012 00:00

Hello Steve,

That's a tough one, you can try using Rado's approach from this blog post, which deals with a similar scenario and uses KnockoutJS.

Regards,
Boyan Barnev
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 12-Jul-2012 00:00

I've already done that (one better, Kendo MVVM http://www.screencast.com/t/8qgVeaFOzjq :)

So is what you're saying that if I have a property defined like this

public Guid[] GuidItemsget;set;

...then the JS to persist that back is just
var selectedForms = ["<guid>","<guid>"];
controlData.SelectedForms = selectedForms;

What's the underlying type of a "Guid Array" field.... Guid[], List<Guid>, Array?...?

Posted by Community Admin on 13-Jul-2012 00:00

Hello Steve,

The field type is Guid[]. Here's a recent example on how we're setting it server side:

personalInformationItem.SetValue("ProfessionalExperience", new Guid[] Guid.NewGuid(), Guid.NewGuid() );


Greetings,
Boyan Barnev
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 13-Jul-2012 00:00

What about client though?  Should it be set back with an object array like I posted?

Like controlData.SelectedForms = selectedForms; should auto-save back from the designer to the backing field right?

This thread is closed