GenericListCellRenderer example: add data to existing list? - codenameone

I use the example GenericListCellRenderer
and cannot find to add a data object to the current list.
And the next were to delete a data from the list.
How may I do this?

First let me start by repeating our recommendation that you don't do that. There are better alternatives.
You need to use a model with map data as explained in the component section of the developer guide.

Related

SuiteCommerce Advanced - Show a custom record on the PDP

I am looking to create a feature whereby a User can download any available documents related to the item from a tab on the PDP.
So far I have created a custom record called Documentation (customrecord_documentation) containing the following fields:
Related item : custrecord_documentation_related_item
Type : custrecord_documentation_type
Document : custrecord_documentation_document
Description : custrecord_documentation_description
Related Item ID : custrecord_documentation_related_item_id
The functionality works fine on the backend of NetSuite where I can assign documents to an Inventory item. The stumbling block is trying to fetch the data to the front end of the SCA webstore.
Any help on the above would be much appreciated.
I've come at this a number of ways.
One way is to create a Suitelet that returns JSON of the document names and urls. The urls can be the real Netsuite urls or they can be the urls of your suitelet where you set up the suitelet to return the doc when accessed with action=doc&id=_docid_ query params.
Add a target <div id="relatedDocs"></div> to the item_details.tpl
In your ItemDetailsView's init_Plugins add
$.getJSON('app/site/hosting/scriptlet.nl...?action=availabledoc').
then(function(data){
var asHtml = format(data); //however you like
$("#relatedDocs").html(asHtml);
});
You can also go the whole module route. If you created a third party module DocsView then you would add DocsView as a child view to ItemDetailsView.
That's a little more involved so try the option above first to see if it fits your needs. The nice thing is you can just about ignore Backbone with this approach. You can make this a little more portable by using a service.ss instead of the suitelet. You can create your own ssp app for the function so you don't have to deal with SCAs url structure.
It's been a while, but you should be able to access the JSON data from within the related Backbone View class. From there, within the return context, output the value you're wanting to the PDP. Hopefully you're extending the original class and not overwriting / altering the core code :P.
The model associated with the PDP should hold all the JSON data you're looking for. Model.get('...') sort of syntax.
I'd recommend against Suitelets for this, as that's extra execution time, and is a bit slower.
I'm sure you know, but you need to set the documents to be available as public as well.
Hope this helps, thanks.

Remove selected object in NSTableView from array

I have an array which contains some objects which are displayed in a NSTableView. I want to delete one of them within my control segment UI (- button).
My table is named deviceTable so I need to find out which row is selected.
deviceTable.selectedRow
I think I need some more code on this to get the selected row? Unsure with that... Now I need to find this object within the array (it's called devices) and delete the object. In Swift 3, that should be
ViewController.devices.remove
I need to give some information on this, because RemoveAtIndex has been replaced with remove. I don't know what to do there - any information on this?
Sorry for asking these questions that might be easy for your expertise guys, it's a problem for me here and I hope someone can help me out.
Well, I definelty need some more sleep ._.
ViewController.devices.remove(at: deviceTable.selectedRow)
reloadData()

Where are the dummy collaborators in in-memory documents?

The documentation suggests that there would be dummy data populating the results from calling getCollaborators, although it does not give any details about what the dummy data would look like.
My calls to getCollaborators return an empty list. It would be quite helpful to populate the list with one dummy collaborator which isMe so that I don't have to check document.isInGoogleDrive all the time.
This has been added to the API. It should be available in about a week.

How to copy document file from one site to another

I am looking for an example where based on the title name with in the object model I want to copy a single file from one Document library to another. I have more than 2000 files and don't want to loop through to complete collection is there any simple way to accomplish this.
There is no method like GetDocumentByName to use. But when do you want to do this? If you want it triggered by a user, you can use a custom action on the document library and when it's triggered you know what item triggered it.
If you want it done by a job I guess you could create a hidden SPView on the library that filters on the title. I'm not sure it's a great solution, but it can be done at least.

SmartGWT mobile Record with SwitchItem

I am moderately new to SmartGWT and am trying to figure out how to have a RecordList where each record has the ability to have a SwitchItem attached to it. So basically create a list of selectable items, but those items also will have a SwitchItem on them to enable/disable some behavior.
Any thoughts on how I can accomplish this?
Looking at Record and RecordList it appears that Record extends HashMap and does nothing fancy like what I am wanting...but i wondered if it was possible to set the "description" property with perhaps some html string that creates the SwitchItem...is this way off? And if so...how is the best way to do this?
Use setShowRecordComponents() and createRecordComponent(). Documentation for how these work can be found in the core SmartGWT docs:
http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/widgets/grid/ListGrid.html#setShowRecordComponents%28java.lang.Boolean%29
There's no support for "recycle" mode yet. A sample is being created.

Resources