Kendo UI grid - different templates for Edit and Create - kendo-ui

We are using Kendo UI grid to display some records. The requirements need us to have a column (Say "File Name")shown as a text box when the user clicks on "Edit".
However, when user clicks on the "Create" button in the toolbar, the same column should be replaced with a File Select control which will allow the user to select a file from his machine. The other columns remain the same.
I have already tried searching through Stack Overflow as well as the Kendo UI Grid forums, but to no avail.
Is there any way to achieve this? Any pointers will be of great help.
Regards,
Nikhil

Using different editor templates for create/edit is not supported. You need to use the edit event of the Grid to change that text input to file input with JavaScript. To distinguish between edit and create you can use the isNew() method of the model.
i.e.
edit:function(e){
if(e.model.isNew()){
//replacement logic
}
}
Similar question is covered here.

Related

Is it possible to Hide Column in Editable grid view of D365?

I've tried doing it with exporting the solution and changes the XML code and then importing it again.
as you can see in the image two bars after 'Do You Want to' column. But when I open this grid in Unified client interface it is still visible.
like in this grid.if 'isAllowOverride' is True I want to make 'Do you want to' be editable. But 'isAllowOverride' has to be invisible from User end.
Not sure why you are editing the xml for such customization. But this can be easily configured in UI itself.
Go to the form editor, open the subgrid properties, check the view it’s configured to show, edit the view columns to remove the unwanted ones, save the view and set the subgrid with the correct edited view again (there’s a product bug which switch to the default Active view), save & publish the form. That’s it.
Update:
We cannot have two different layouts for Display mode vs Edit mode. That being said, you have to disable the editable grid columns based on conditions.

Sitecore page editor dropdown

I would kindly ask for your help :) From couple of days I am trying to achieve "linked" custom field in content editor and dropdown in page editor.
Basically I want to have dropdown in page editor and content editor which are responsible for a same thing.
In my c# code i have enums which represent directions. I created custom field which accepts assembly and class with overridden onload method and successfully populate dropdown values in the content editor. So far so good but i have no idea how to create dropdown which will represent the same functionality inside page editor.
So please give me any ideas...
Judging from your reply to my comment you need to think of the following: How is my field value being rendered onto a page?
If you are always using 1 control to do this then you just need to ensure that this control has 2 different rendering modes depending on the Context.PageMode
But as I understand it you want this dropdown to also appear when someone renders your custom field using a <sc:FieldRenderer>. In this case you'll need to look into the RenderField pipeline of Sitecore. There you find a processor called RenderWebEditing. Possibly through some manipulation here you can get your dropdown appear as you wish.

Kendo Grid - Lazy Load On Popup Edit

I am using Kendo UI ASP.NET MVC Grid (Razor) in Ajax mode with a popup editor.
As an example say: Customers have orders
User of the application go to a grid that displays all customers. User is allowed to add/edit/delete customers (and their orders). But when the user clicks on edit and the popup editor comes up that is when I want to load orders. I do not want to load orders eagerly since a customer may have many orders and the user may never edit any customer at all.
Seems like this should be a simple thing to do. I have looked through all forums/questions. I have not been able to find such an example. Can someone help me with this?
Thanks a bunch!
j
Are the orders already loaded when the initial grid is loaded (are they in the model)?
If not, one way to do this is define a grid in your popup editor and set .Autobind(false) and set its Read action to a Controller/action.
When editing a record, you can fire a .refresh() on the datasource of the Orders grid.
I would need some more info on the structure of the template and the grid.

Adding checkbox inside a listview in dhtmlx

How can i add check box inside combo box within the grid view.
As far as I know - it impossible, but they have similar editor type - "clist", check
http://www.dhtmlx.com/docs/products/dhtmlxGrid/samples/01_cell_types/09_pro_excell_extra.html
You can outside the grid view, like this link suggest (from the official dhtmlx forums).
But inside the grid you cannot.
The closest answer I found on the official dhtmlx forums said:
There is no special integration of combo with checkboxes and dhtmlxgrid.
"combo" column type purposed to be used with plain combobox mode only.
Technically it possible to change it , so it will render as list with checkboxes, but checked values will not be accessible through grid's API
I hope this answer could help you. If not, you should ask the dhtmlx team directly, as it does not seem to be possible without imperfect workarounds.

jqGrid using radio buttons for editable rows

I'm currently using jqGrid and ASP.Net MVC. With my current project, my goal is to provide a grid of data to the end user, and they can then edit this. The data is machine-generated, and the users will be confirming if the machine is correct or not.
I think ideally for speed, I'd like to provide a row per item, with a radio button group as the editable. The users could then pick from the values 'Unknown', 'Correct', 'Incorrect'.
As there will be a lot of data, I'd also like to provide a control of some type that can set all rows in the grid to one of the available radio button choices, for the user experience.
Given that there seems to be no native support for this in jqGrid, I wanted to ask if anyone has had any experience writing something like this, and whether this is achievable and reliable, or whether I should stick with the drop-down editable approach that is native to jqGrid.
To implement radio button as the editable instead of the standard drop-down editable approach you can use so named custom editing feature of jqGrid (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:common_rules#custom). This allows you to create any custom control to edit the cell value. An example of the implementation you can find here: Add multiple input elements in a custom edit type field.
To set all rows in the grid to one of the available radio button choices you can use either a control outside of jqGrid or add an additional custom button in the navigation bar (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:custom_buttons). If you search for navButtonAdd you will find a lot of examples how to implement this, for example, Jqgrid: navigation based on the selected row. Because you use server based data, you can just call a method on the server to make the changes which you need and then call trigger("reloadGrid") to refresh jqGrid data.

Resources