Telerik Forums
UI for ASP.NET MVC Forum
0 answers
99 views
Hi,
I implemented Kendo Grid helper in a MVC 4 with WebApi application, but I don't know how can I set de column list to change dinamically the rows that it shows.
My code:
@(Html.Kendo().Grid<Bitacora.WebUI.Models.WhiteBoard.XXXGridModel>()
            .Name("Grid")
            .AutoBind(true)
            .EnableCustomBinding(true)
            //.BindTo(Model.xxxx.YYYList)
            .Columns(c =>
            {
                c.AutoGenerate(column =>
                {
                    //customize autogenereted column's settings                                                    
                    column.Width = "150px";
                    
                    //column.ClientTemplate = "<input type='checkbox' name='checkbox' />";

                });
            })
            .Scrollable(scrolling => scrolling.Enabled(true).Height("auto"))
            .Resizable(x => x.Columns(true))
            .Events(events => events.Change("searchCalls"))
            .DataSource(dataSource => dataSource
                                                .Ajax()
                                                .Read(read => read
                                                   .Action("Search", "api/ActionApi")
                                                   .Data("getFiltersSelected")
                                                   .Type(HttpVerbs.Post))
                                                   .ServerOperation(true)) // Paging, sorting, filtering and grouping will be done server-side  
                                                //.ColumnMenu()
                                                .Selectable(selectable => selectable
                                                    .Mode(GridSelectionMode.Multiple))
                                                .Reorderable(reorder => reorder.Columns(true))
                                                .Groupable(grouping => grouping.Enabled(true))
                                                .Filterable(filterable => {filterable
                                                                            .Operators(operators => 
                                                                                        {operators.ForString(strFilter => strFilter.Clear().Contains("contains"));
                                                                                            operators.ForNumber(strFilter => strFilter.Clear());
                                                                                        });
                                                                            filterable.Extra(false);
                                                            }) //--> sólo se muestra el contains en las columnas Texto
            .Sortable(s=> s
                .SortMode(Kendo.Mvc.UI.GridSortMode.MultipleColumn)
                .AllowUnsort(true))
            .Pageable(pager => pager
                .Enabled(true)
                .Input(true)
                .PageSizes(new [] { 5, 10, 20, 30, 40, 50 })) // MULTIDIOMA RESOURCES

My Model:

 public class XXXGridModel
    {
        [Display(Name = "Id", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int Id { get; set; }
         [Display(Name = "DateCreated", ResourceType = typeof(WhiteBoardGridVMResource))]
        public DateTime DateCreated { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string CallNumber { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string FileNumber { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string DUE { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int IdBranchOffice { get; set; }
         [Display(Name = "BranchOfficeName", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string BranchOfficeOfficeName { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int IdCompany { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string CompanyCompanyName { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int IdOffice { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string OfficeOfficeName { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int IdShip { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string ShipShipName { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int IdPort { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string PortPortName { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int IdCallStatus { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string CallStatusStatusName { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int? IdOwner { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string OwnerThirdPartyName { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int? IdOperator { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string OperatorThirdPartyName { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int? IdInductor { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string InductorThirdPartyName { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public bool IsNominatorOwner { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public bool IsNominatorOperator { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public bool IsNominatorInductor { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int IdCreatedBy { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string CreatedByUserName { get; set; }
        }

Anyone can Help me?!
Thanks in advance
Ivan
Top achievements
Rank 1
 asked on 13 Jun 2013
1 answer
184 views
Is there a way to edit grid rows in a separate view. I need to accomplish this because the modal has too much information so it needs to be displayed in a separate view.

grid.bind("edit", function (e) {
                window.location = '@Url.Action("AddEditCoalition","Form",new{coalitionId=Model.CoalitionId})' + '&formId=' + e.model.Id;
});
The only problem is the modal shows up is there anyway to do this without the modal showing at all and it goes stratight to the seperate view?
Rosen
Telerik team
 answered on 13 Jun 2013
6 answers
1.1K+ views
Hi,
I'm trying to understand how to bind an action from the Db to the kendo menu. 
in all the demos I saw there is and Item.add().text().action("action","controller");

but if I bind to Db then I have:
Item.Text = "Some Text";

how should I attach the action method to the menu? (what should be the right side of the item.Action = ?)
I would also like your opinion as to the way to store it in the Db (if there is any best practice regrding this matter).

thank you
ShareDocs
Top achievements
Rank 1
 answered on 12 Jun 2013
0 answers
267 views
(the sample application that I wanted to attached is slightly above 2MB  after having removed binaries, etc... can I email it to someone for support?)

We have a requirement to drag data from multiple sources and drop it to a treeview. To illustrate the problem(s)...  I am including a VS 2012 Sample project that includes a destination treeview on the left side and another treeview and grid on the right side. The treeview on the left is populated from one database and the treeview and grid on the right from another. The goal is to copy (and not "move) data from one database (on the right) to the other (on the left).
The sample is based on the Northwind database.

I couldn't find solutions to many many problems so I just rather to provide a clean sample project so hopefully it can be completed (instead of creating multiple different support tickets). Other that some fragments of JavaScript I could not find any functional and practical sample fully implementing a typical drag and drop scenario on an MVC project with Kendo.

These are the needs which hopefully can be addressed on the provided sample app.:

1) We want to drag from the source treeview to the destination treeview... How can we configure the source treeview visual indicators so users know that they can "drag" but not "drop"on the (same) source treeview but on the treeview on the left?

2) How can we identify the parent node (the target) to which data is being dropped? (I tried the target and dropTarget field but got "undefined"). The other problem is that in our real application, for some reason when data is being  dragged from the grid we do not see any target information (all objects are "undefined").

3) The treeview is very smart and adds the dragged node automatically when dragging from one treeview to the other... However, it is not the case when dragging from the Grid. Can we get some code about how to accomplish this (even better... modify the sample)  so when dragging from the grid instead of a TreeView, the destination treeview behaves exactly the same (e.g. so it displays the same built-in visual effects when hovering between sibling nodes, a parent node or on a node that doesn't allow child nodes, 
etc..)

4) Since we had problems retrieving the destination treeview's targetNode, I could not go further and persist the dragged node to the database implementing an Ajax post to a controller action. It would be great to have that part.

5) The idea is to copy and not move data... How can we prevent Kendo to visually remove automatically the source node from the source treeview once it's been dragged out?


Basically... if someone can complete the sample so it allows transferring data from one Northwind database to another (using either the treeview or the grid on the right to the one on the left) it would be great

Alejandro
Top achievements
Rank 1
 asked on 12 Jun 2013
2 answers
326 views
Hi, I am new to the Kendo UI controls and am evaluating them for potential use in a new project. I am having difficulty getting unobtrusive validation to work for a numeric text box. On the same view, I am able to get unobtrusive validation to work for a Kendo date picker. I am at a loss to understand what I am missing from my MVC4 project. 

I have attached the source for my view, my model, my controller and the html output. I have also attached a screen grab of the unobtrusive validation working for the date picker and not the numeric text box.

Any help would be appreciated. Thanks!
Scott
Top achievements
Rank 1
 answered on 12 Jun 2013
5 answers
2.0K+ views

Hi,

Is it possible to find a node by id (clientside)?

Here is how we populate the treeview.

public JsonResult _AjaxLoading(string id)
{
IEnumerable nodes = from item in GetDirectorys()
where (id == null ? item.parent == "" : item.parent == id)
select new
{
id = item.directory,
Name = item.name,
hasChildren = item.aantal > 0,
};
return Json(nodes, JsonRequestBehavior.AllowGet);
}
Shruthika
Top achievements
Rank 1
 answered on 12 Jun 2013
2 answers
158 views
Has anyone successfully placed the RadEitor within a TabStrip control. ? The Radeditor is always displayed outside of the tabstrip at the top of the form (see attached image).

//sample code
@(Html.Kendo().TabStrip()
    .Name("configuration")
    .SelectedIndex(0)
    .Items(tabstrip =>
     {
     tabstrip.Add()
         .Text("General Settings")
         .Content(@<text>
                   @Html.LabelFor(model => model.Appcutoffdate)    
                   @Html.EditorFor(model => model.Appcutoffdate)           
               </text>);
     tabstrip.Add()
        .Text("Email")        
        .Content(@<text>
                   @{ Html.Kendo().EditorFor(model => model.EmailAcceptBody)
                      .Name("EmailAcceptBody")
                      .Encode(false)
                      .Render();                                                                              
                      }            
               </text>);
     })
)


Thanks
Mike
Mike
Top achievements
Rank 1
 answered on 12 Jun 2013
4 answers
710 views
Hello,

I'm trying to make a grid with PopUp-Mode. Now I need a customized content for the editing-window. I know it is possible to define a "TemplateName" which directs to an EditorTemplate. But in this case I'm not allowed to use an EditorTemplate for different reasons.

I saw in other posts (eg: http://www.kendoui.com/forums/ui/grid/custom-popup-editor-with-additional-fields.aspx#MtaYNNFFv0aHX5-drisScg ) where the Grid was not initialized by the MVC-wrapper, that it is possible to define a template which uses a script (type="text/x-kendo-template") like the following:
<script id="gridEditTemplate" type="text/x-kendo-template">
    Content here
</script>
So in my case I also want to use this kind of template for the editing-window.

Here is my Code of the Grid:
@(Html.Kendo().Grid(Model.Amounts)
    .Name("MyGrid")
    .BindTo(Model.Amounts)
    .ToolBar(commands => commands.Create().Text("add"))
    .DataSource(dataSource => dataSource
        .Ajax()
        .Events(ev => ev.Change("onChange"))
        .Update("Update", "Special")
        .Destroy("Delete", "Special")
        .Create("Insert", "Special")
    .Model(model =>
    {
        model.Id(p => p.ID);
        model.Field(p => p.Amount);
        model.Field(p => p.Type);
    }).ServerOperation(false))
    .Columns(columns =>
    {
        columns.Bound(p => p.Amount).Title("Amount");
        columns.Bound(p => p.Type).Title("Type).Width(70);
        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(160);
    })
    .Editable(editable => editable.Mode(GridEditMode.PopUp).CreateAt(GridInsertRowPosition.Bottom).Window(w => w.Title("Amounts: ")))
)

So what can I do to use a specific template-script? I can't use an EditorTemplate.

Thank you!
BigzampanoXXl
Top achievements
Rank 1
 answered on 12 Jun 2013
1 answer
67 views
I think I found a little bug. I can reproduce it with your demo with the Opera 12 and the IE10 browser.

reproducing steps for the demo:

click "add new record"
move to page 2
move back to page 1
now you have an empty row in the grid

If you press the create button twice, the validation message will show, but if you move the page (you CAN move the page), the validation message won´t show.
Vladimir Iliev
Telerik team
 answered on 12 Jun 2013
0 answers
75 views
I'm trying to do the edit for a grid in separate view. The reason I need to accomplish this is because the information is too large for a modal. Right now this is how I'm moving to the new view.

grid.bind("edit", function (e) {
                grid.cancelChanges();
                window.location = '@Url.Action("AddEditCoalition","InputData",new{coalitionId=Model.CoalitionId})' + '&formId=' + e.model.Id;
}
Is there a cleaner way to do this becuase I little bit of the modal does popup intialy before changin to a new view.
Chrys
Top achievements
Rank 1
 asked on 11 Jun 2013
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
ComboBox
Upload
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Security
Wizard
Styling
Chat
DateInput
MediaPlayer
TileLayout
Drawer
SplitView
Template
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
SegmentedControl
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?