on 2016 Apr 25 2:44 PM
Hi All,
I am trying to create a custom control which displays a Treegrid using the external libraries ,where i need to create the treegrid by specifying the div name in which the tree gets created.
for example :
In the above example we need to mention the "div id". So that the tree gets created in that div i.e "#treeGrid".
But when i try to create a custom control i can create a div only in the renderer() but not in onInit().
Therefore my question is how can we give a dynamic DIV ID to generate the tree in that respective div, moreover what is way to create this type of custom control.
The below link is the working example of the treegrid which need to be converted as custom control.
Regards,
Saikiran Bommagowni
Request clarification before answering.
No need to use third party library. SAPUI5 has own tree control. First impression is that UI5 tree table is not worse then jQuery Tree Grid. If You are following SAP UI principles - use correct control in correct place ))
here is component - https://experience.sap.com/fiori-design/ui-components/tree-table/
hope usefull.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Saikiran,
Are you going to re-use this everywhere in your code? - Is it a matter you really need a Custom Control or just a matter to apply this into an UI5 Element?
Custom Controls are better for code re-use but in order to define then, you will end up with more code being executed and also transmitted - even thou they seem to be "good practice" inflating execution time and bytes transferred for no good reason hardly translates into good.
Case you decide the Custom Control path, you can find more information here: OpenUI5 SDK - Demo Kit
However, be careful how you deal with your properties, otherwise you will end up with DOM Nodes being "re-created" which will very likely kill the performance of your application.
Cheers,
Dan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Saikiran,
Well, it does look like you could use a custom control.. go for it. On my previous reply I did hyperlink the section on the UI5 on how to create a custom control.. rather straight forward.
The "tricky" part not explained is, the "attributes" of your custom control are managed by default by UI5 and this means, UI5 will end up creating getters and setters for them.
The default mutators do not supress the invalidate on the control, which means, every time you change a property in your control it will destroy the DOM nodes (of your control and anything below it) and re-build it.
This is the worst possible behavior in terms of performance, so make sure to overwrite the mutators to supress the invalidate when needed so you don't have performance issues.
Cheers,
Dan.
PS: Case you have trouble to understand what to do I suggest you visit openui5/src/sap.ui.commons/src/sap/ui/commons at master · SAP/openui5 · GitHub because there are a lot of examples from the library itself.
| User | Count |
|---|---|
| 8 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.