JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Data Grid › HAVING THE COLUMN CONFIGURATION AS JSON FORMAT
Tagged: custom Editor
- This topic has 3 replies, 3 voices, and was last updated 1 year, 8 months ago by svetoslav_borislavov.
-
AuthorPosts
-
March 16, 2023 at 2:02 pm #104529Manikanda PrabakaranParticipant
Hi Team,
I want to know does the CONFIGURATION for the data grid supports the JSON format.
As we have configuration residing in a separate project which is consumed by the main application.
An example use case is
CUSTOM CELL EDITOR: https://www.htmlelements.com/angular/demos/grid/editing-custom-editor/
<div>
<div> {</div>
<div> label: ‘Mood’, dataField: ”, editor: {</div>
<div> template: ‘#moodEditorTemplate’,</div>
<div> onInit(index, dataField, editor) {</div>
<div> editor.addEventListener(‘click’, function (event) {</div>
<div> editor.firstElementChild.value = event.target.innerHTML;</div>
<div> });</div>
<div> }</div>
<div> }, width: 70, align: ‘left’, template: ‘#moodTemplate’,</div>
<div> },</div>
</div>
In above case, Can I use strings where I can configure Template from my Typescript file . So my configuration works as a JSON format.- This topic was modified 1 year, 8 months ago by Manikanda Prabakaran.
March 16, 2023 at 9:35 pm #104532ivanpeevskiParticipantHi Manikanda,
the ‘template’ property can also be set as an HTML string. For example, this will produce the exact same result as the one in the demo:
template: `<div tabindex=0 style=”padding: 0px; display:flex; justify-content: center;”><span
tabindex=1>😊</span><span tabindex=2>😐</span>
<span tabindex=3>😂</span>
</div>`Best Regards,
Ivan Peevski
Smart UI Team
https://www.htmlelements.com/March 17, 2023 at 10:15 am #104553Manikanda PrabakaranParticipantThanks for the update, In my case i might have different configuration for my clients placed in a separate repository (Ex: Repo A). Also I want to control that in my application which is in another repository (Repo B). For ex: click action, OnInit Events, in these cases I want the configuration to be of JSON format with some Component name as the value for the key in the column configuration (something like that) so that I can have different column config controls(custom cell editor ex: datepicker, where i want to disable future dates). Also I want to perform client side validation when using inline editing . In all these cases, If I have a control on my application(Repo B) it suit my needs, rather than been set on the Column configuration (JSON file) present in Repository A.
March 20, 2023 at 4:48 am #104566svetoslav_borislavovParticipantHi,
You may fetch the JSON and parse it to a plain object. The config cannot be JSON.
Best Regards,
Svetoslav BorislavovSmart UI Team
https://www.htmlelements.com/ -
AuthorPosts
- You must be logged in to reply to this topic.