Syncfusion Xamarin sfList - How to get hold of list item template instance? - syncfusion

Is it possible to directly address the View instance behind the selected item in a sfList? Rather than using bindable properties I would prefer to just set properties directly on the views contained in the layout instance that displays the selected item (without affecting the properties of all the other itmes based on the template?
Possible somehow?

We have checked with the reported query “Need for customization of list item template” from our side. We would like to let you know that the SfListView provides support for customizing the appearance of each item with different templates based on specific constraints using DataTemplateSelector. You can refer the following UG documentation link for more information.
Documentation link: https://help.syncfusion.com/xamarin/sflistview/viewappearance#defining-the-data-template-selector

Related

Drag & drop in custom tree view [duplicate]

I have successfully populated a TreeView via creating a TreeDataProvider and customized the icons and its collapse-able property. Now I want to be able to drag and drop its ViewItem(s) onto a WebView. There are unfortunately no samples for drag and drop. Reading through the TreeView source, ViewItem(s) are created in HeightMap.OnInsertItems() via the TreeView.createViewItem(), from the derived class.
The public TreeView.onInsertItem() would appear to be a great extension point, extending TreeView and onInsertItem() and capturing its ViewItem parameter. This Unfortunately, the creation of the concrete class, ExtHostTreeView, that is ultimately created, is buried in layers of private methods (createExtHostTreeViewer()).
Strangely, the ViewItem has a setter for draggable. However, how would you ever get a reference to the ViewItem to set it? If there is a way to do this please point me at an example. If there is not, I would be glad to fork and implement it. Leaving the existing onInsertItem and perhaps add an array of handlers to be added to with an addOnInsertItemListener() method? Or perhaps use RxJS?
There are so many places this could be used. You could drag template fragments into documents or code, DSL rules into a expert system, configuration file values into parameters or right hand values (generating the code to retrieve the value). Thank you for any assistance.
It seems that drag and drop in custom views is currently not supported. There's a (fairly popular) feature request for it here:
Add drag and drop for contributed tree views (#32592)
As of version 1.66 (March 2022) there is a TreeDragAndDropController which can be used for some drag & drop actions.
In April 2022, their sample focuses on drag & drop within a tree view: https://github.com/microsoft/vscode-extension-samples/blob/main/tree-view-sample/src/testViewDragAndDrop.ts
It is also possible to use the text/url-list type as described in the documentation to allow for dragging files to the editor panel: https://github.com/microsoft/vscode/blob/dc2f5d8dd1790ac4fc6054e11b44e36884caa4be/src/vscode-dts/vscode.d.ts#L9843-L9859
It is not clear to me yet whether it is possible to drag arbitrary data to webviews or to use standard HTML5 drag & drop API in a webview to allow dragging data to a custom tree view.

Including list view of relationship entity on update page

I am trying to extend an update view to include a list view of some related items below the edit form.
I have two models, Publishers and Volumes, which have a many to many relationship. What I am trying to do is this.... when a user clicks on the edit button for a publisher, I want them to go to a page with the standard edit fields, but also have a list view below the form that lists all of the volumes that are connected to that publisher via their relationship.
Is there an easy way to do this?
I hope this makes sense.
As #tabacitu mentioned, Backpack doesn't currently have an built in solution for this. That said, this could maybe work for you:
This would allow you to use all functionality of the nested list view including interacting with the entities without conflicting at all with the parent
Step 1, Build your normal CRUDs
Build out two normal CRUDs, one for Publishers, and one for Volumes
Step 2, Make a frameless layout
copy vendor/backpack/base/layout.blade.php
name it frameless-layout.blade.php
remove #include('backpack::inc.main_header') and #include('backpack::inc.sidebar')
Step 3, Make a custom list view
copy vendor/backpack/crud/list.blade.php
name it sub-list.blade.php
change the top line to #extends('backpack::frameless-layout')
Step 4, Make a custom field
Create a custom form field that contains an iFrame
Inside your custom field template, have it set the url of the iFrame to the "list" url of the related resource
You'd also need to utilize List Filters and a method for setting them dynamically so that the sub-list shows only the records related to the parent
Step 5, Configure and use the field
In your crud controllers, use the addField to add the the configuration for the new field and its related model
Indeed, there's no standard functionality to do that in Backpack. It's a pretty unusual way to do things. But it's not too difficult to achieve it.
If there aren't too many Vendors for one Publisher (as I expect it's the case here), I would keep it simple and NOT try to include the entire Backpack list view (with ajax, buttons, filters, etc) on top of the form. I would add a standard HTML table with the entries (and optionally buttons to Edit Vendor with target=_blank).
Here's how I would go about it:
In the Publisher CRUD, I would use a custom view for the Edit operation; you can do that using $this->crud->setEditView('edit_publisher_with_vendors') in your setup() method;
In that custom edit view (edit_publisher_with_vendors.blade.php in my example), I would copy-paste everything inside the edit.blade.php view that Backpack/CRUD is using, and add a table with the Vendors on top of the Edit form; notice you have the current entry as $entry in this view; since there's a relationship on the model, you would be able to check if it has vendors using $entry->vendors()->count(), and get the vendors using $entry->vendors.
Hope it helps.

Adding drag and drop support in a custom TreeView

I have successfully populated a TreeView via creating a TreeDataProvider and customized the icons and its collapse-able property. Now I want to be able to drag and drop its ViewItem(s) onto a WebView. There are unfortunately no samples for drag and drop. Reading through the TreeView source, ViewItem(s) are created in HeightMap.OnInsertItems() via the TreeView.createViewItem(), from the derived class.
The public TreeView.onInsertItem() would appear to be a great extension point, extending TreeView and onInsertItem() and capturing its ViewItem parameter. This Unfortunately, the creation of the concrete class, ExtHostTreeView, that is ultimately created, is buried in layers of private methods (createExtHostTreeViewer()).
Strangely, the ViewItem has a setter for draggable. However, how would you ever get a reference to the ViewItem to set it? If there is a way to do this please point me at an example. If there is not, I would be glad to fork and implement it. Leaving the existing onInsertItem and perhaps add an array of handlers to be added to with an addOnInsertItemListener() method? Or perhaps use RxJS?
There are so many places this could be used. You could drag template fragments into documents or code, DSL rules into a expert system, configuration file values into parameters or right hand values (generating the code to retrieve the value). Thank you for any assistance.
It seems that drag and drop in custom views is currently not supported. There's a (fairly popular) feature request for it here:
Add drag and drop for contributed tree views (#32592)
As of version 1.66 (March 2022) there is a TreeDragAndDropController which can be used for some drag & drop actions.
In April 2022, their sample focuses on drag & drop within a tree view: https://github.com/microsoft/vscode-extension-samples/blob/main/tree-view-sample/src/testViewDragAndDrop.ts
It is also possible to use the text/url-list type as described in the documentation to allow for dragging files to the editor panel: https://github.com/microsoft/vscode/blob/dc2f5d8dd1790ac4fc6054e11b44e36884caa4be/src/vscode-dts/vscode.d.ts#L9843-L9859
It is not clear to me yet whether it is possible to drag arbitrary data to webviews or to use standard HTML5 drag & drop API in a webview to allow dragging data to a custom tree view.

TYPO3: Difference between Plugin and Custom Content Element?

I have to implement a media download feature. The backend user should be able to upload a media file, set the title, description, release date and so on... The result should then be visible and the file available for download in the frontend.
I am not sure what is the best way to achieve this: Plugin or Custom content element ?
Whats the main difference between the two and what would be the best solution for my task ?
Plugins are used for more complex rendering of records with different views (for example a list and a detail view of records stored somewhere in a storage folder). A custom content element (CE) should be preferred if all relevant data is stored in the record.
For your case, a Content Element seems to be the right solution. This kind of custom content elements can also be easily created with helpful extensions like "mask" which may takes you 10 minutes to create a custom CE.
https://typo3.org/extensions/repository/view/mask
If I understood you properly.
You can define plugin as type of "list_type", or as "CType" (if you need to code specific function, which is hard or unable to achieve using eg. Fluid contents) or even as another menu type defined as "menu_type".
These all types can be the same way made plugin, this separation for types are basically only for making it appear in different selectors. So:
your plugin defined as menu_type is to be selected in "Special Menus" content type in "Menu type" selector,
defined as list_type (so called) is to be selected in "Insert Plugin" content in "Selected plugin" selector,
defined as CType is totally new content type.
But they work the same way and this is easily to be switched using parameter in ext_tables plugin register call:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin( ['Label', $_EXTKEY.'_myPluginSuffix'], 'CType');
1) You can use the "File Link" content element and adapt its TypoScript (tt_content.uploads.20.renderObj) to your needs.
2) You can use the file_list extension and adapt its Fluid templates to your needs

Validating datagrid cell values using Enterprise Library config file

In my application,I am working on WPF with MVVM design pattern doing validations through Enterprise Library using configuration file.
I want to validate my grid cell values through enterprise library configuration file.In my view model I have an objservalble collection property that is bound to the datagrid in a view.
Then,I want to validate one of my cell value for range validation using enterprise library..But I am not finding any proper way to do the same.I don't want to use any custom validator rather want to achieve with the enterprise library configuration file only.
Actually while adding a validation to datagrid column we are binding like:-
<xa:ValidatorRule RulesetName="NameOfRuleset" SourceType="{x:Type vm:ViewModelType}" SourcePropertyName="NameOfProperty" ValidationSpecificationSource="Configuration" ValidatesOnTargetUpdated="True" />
But as in this case my view model will not have a property specifically for this field rather it has collection,so i am stucked on how to do the same,
Can anyone please guide me how to achieve the same.Please let me know if my explanation is not clear enough.
Found a solution for the same.
Created a one more class for my collection & in configuration file as well as in view I am refering to that class type only instead of refering to my viewmodel.
Reason why I created new class is I am using Entity framework & i cannot refer to DAL layer in my UI but I can refer to my own type in view.
In this way it solved my problem of adding validation rules to the datagrid that is binded to the collection.
Incase anybody needs sample code,let me know I can provide the same.