Telerik Forums
UI for ASP.NET MVC Forum
2 answers
196 views

Having some Grid formatting issues with a grid in a partial view, loaded via ajax function and pass it a parameter.    It appears that the grid is partially created and displayed to soon. I have attached 2 screenshot. to show what is going on. using bootstrap

Basically the process should be call the grid.  the loading.... dialog should be first, then the grid loaded when successfull with norecords shown inside of grid.  This is happening way out of order.  I am probably missing a process..

Main view:

@model Jlo4MVC.Models.UserToSend
 
@{
    ViewBag.Title = "JLO";
}
 
<div id="userinput" class="row">
    <ul class="userrentry">
        <li>
            @Html.Label("User ID")
            @Html.Kendo().TextBox().Name("searchuserid")
        </li>
        <li>
            @Html.Kendo().Button().Name("findUser").Content("Search for Sessions").HtmlAttributes(new { @class = "k-button" })
        </li>
    </ul>
</div>
<div id="sessionsfound" class="row" style="display:none">
 
</div>
<div id="status" class="row" style="display:none">
</div>
<div id="gridloading" class="imgdiv" style="display:none">
    <img id="loader" src="~/Images/ajax-loader.gif" class="center-block" />
</div>
<script type="text/javascript">
    $(function () {
        
        $('#findUser').click(function () {
            
            var myurl = '@Url.Action("getSessionsView", "home")';
            var model = { userID: $("#searchuserid").val() };
            $('#userinput').css("display", "none");
             
            $.ajax({
                url: myurl,
                type: "POST",
                datatype: "html",
                data: model,
                success: function (data) {
                    $('#sessionsfound').html(data);
                    $('#sessionsfound').css("display", "block");
                }
            })
 
        });
    });
</script>

 

Partial view

@model Jlo4MVC.Models.UserToSend
 
 
<div>
    @(Html.Kendo().Grid<Jlo4MVC.Models.SessiondataDTO>()
        .Name("VSM_Grid")
        .NoRecords("No Sessions Found")
        .Columns(c =>
            {
                c.Template(t => { }).ClientTemplate("<input type='checkbox' class='checkbox' />");
                c.Bound(i => i.id).Title("ID").Width(10);
                c.Bound(i => i.farmName).Title("Farm").Width(25);
                c.Bound(i => i.domainName).Title("Domain").Width(25);
                c.Bound(i => i.applicationName).Title("App Name").Width(75);
                c.Bound(i => i.serverName).Title("Server").Width(25);
                c.Bound(i => i.sessionID).Title("Session ID").Width(10);
                c.Bound(i => i.userID).Title("User ID").Width(40);
            })
 
        .DataSource(data => data
        .Ajax()
        .Model(m => m.Id(p => p.id))
        .Read(read => read.Action("sessionsread", "Home", new { userID = Model.userID })))
 
    )
 
 
</div>
 
 
 

 

 

 

 

 

 

J
Top achievements
Rank 1
 answered on 01 Aug 2017
1 answer
207 views

Hi,

I have the following grid...

$("#grid").kendoGrid({
            toolbar: ["excel"],
            excelExport: function (e) {
                e.workbook.fileName = "Test.xlsx";
                e.workbook.sheets[0].title = 'Hello World';
              
                var rows = e.workbook.sheets[0].rows;
                e.workbook.sheets[0].rows.unshift({
                    cells: [
                      {
                          value: ''
                      }
                    ],
                });
                e.workbook.sheets[0].rows.unshift({
                    cells: [
                      {
                          value: 'Football: ' + $('input[name=mnuFoot]:checked').val(),
                          bold: true
                      }
                    ],
                });
                e.workbook.sheets[0].rows.unshift({
                    cells: [
                      {
                          value: 'Soccer: ' + $('input[name=mnuSoccer]:checked').val(),
                          bold:  true
                      }
                    ],
    
                });
 
                for (var ri = 0; ri < rows.length; ri++) {
                    var row = rows[ri];

                    if (row.type == "group-footer" || row.type == "footer") {
                        for (var ci = 0; ci < row.cells.length; ci++) {
                            var cell = row.cells[ci];
                            if (cell.value) {
                                 //Use jQuery.fn.text to remove the HTML and get only the text
                                cell.value = $(cell.value).text();
                                //Set the alignment
                                cell.hAlign = "right";
                            }
                        }
                    }
                }
            },

......

How can I export the data using the same functionality as the button on the toolbar using a button outside of the grid?

 

Thanks,

Liem

 

Liem
Top achievements
Rank 1
 answered on 01 Aug 2017
1 answer
620 views

HI All,

        Is it possible to convert kendo UI filter textbox to dropdown and bind custom data? I need answer in server side grid. pls see attachment

Georgi
Telerik team
 answered on 31 Jul 2017
1 answer
555 views

I have a Kendo MVC Grid that has a column with a DateTime column.    Everything looks good and formats correctly.   When i filter,  it gives me a date picker and a time picker.  When i remove the DateTimeFilter Template below and use template contains,  it will give me a Date picker (which i want),  but still wants to filter by the date and time..     Is there a way i can have the date and time all as the same field,  but only filter with a Date picker.?     Example:  i use the Date picker to pick 07/24/2017 and it filter everything on that date regardless of time..      Or do they need to be completely different fields,  or even concatenated fields in the same column.?

 

the Column data looks as such:  07/24/2017 18:12:00 

columns.Bound(c => c.CreatedDate).Title("Submitted On")

.ClientTemplate("#= kendo.toString(kendo.parseDate(CreatedDate), 'MM/dd/yyyy HH:mm:ss') #")

.Filterable(ftb => ftb.Cell(cell => cell.Template("DateTimeFilter")));

Georgi
Telerik team
 answered on 28 Jul 2017
6 answers
436 views

Hello, and thank you in advance for any and all help.

I do not know if this is a known bug, something I have discovered, or something I am simply doing wrong.

.Selectable(selectable => selectable
        .Mode(GridSelectionMode.Multiple)
        .Type(GridSelectionType.Row))
.Resizable(resize => resize.Columns(true))
.AllowCopy(true)

 

This is how I have my grids set up. However, I notice copy/paste will fail from the grid unless all columns are showing. I use hideColumn() and showColumn() to allow a user to dynamically select what columns they wish to see. Is this a known issue, or is it a strict requirement that all columns have to be showing for copy/paste to work? Is there a workaround, if that is the case?

Thank you again!

Stefan
Telerik team
 answered on 28 Jul 2017
2 answers
1.2K+ views

I have a application that has a kendo grid.

I can filter the grid using several dropdownlists that are outside the grid.

When I click on search, I add filters to the datasource filter list. For example,

    var dataSource = $("#grid").data("kendoGrid").dataSource;
                var dataSourceFilterQuery = new Array();
   
        if ($("#something").data("kendoDropDownList").value() !== null) {
                        dataSourceFilterQuery.push({ field: "something", operator: "IsGreaterThanOrEqualTo", value: ($("#something").data("kendoDropDownList").value()) });
                }
   
                dataSource.filter(dataSourceFilterQuery);    

Then I get the results I want. It works.
I then have the possibility of saving the values of all the dropdownlists as one filter in localStorage.

     const filtersObject = {
                    Something: whatever.value(),
                    ...
                };
   
                this.storage.setItem("Filter", JSON.stringify(filtersObject));

When I restart the application, the dropdownlists are populated with whatever is in localStorage

    const filter =  JSON.parse(localStorage.getItem("Filter"));
   
                    $("#something").data("kendoDropDownList").value(filters.whatever || "");               
                }

The thing is, I wanted to add these filters, if they exist on localStorage, to the datasource when the application starts so that the user can see the results of the filter he saved when the applications starts and not have to click on search again.

So, what I want is to do apply this

    var dataSource = $("#grid").data("kendoGrid").dataSource;
                var dataSourceFilterQuery = new Array();
   
        if ($("#something").data("kendoDropDownList").value() !== null) {
                        dataSourceFilterQuery.push({ field: "something", operator: "IsGreaterThanOrEqualTo", value: ($("#something").data("kendoDropDownList").value()) });
                }
   
                dataSource.filter(dataSourceFilterQuery);

before the grid is displayed.

Is this possible?

Tks in advance.

Rui
Top achievements
Rank 1
 answered on 27 Jul 2017
2 answers
307 views

I have a page with a Kendo grid and several controls (picture 1).

It works fine, no problem here. I now have to replace the dropdownlist that is open in the picture with a multiselect.

After I changed the drop to a multi, which works just fine, something strange happened ( picture 2).

The layout is all messed up and the grid stopped working.

I change it back to drop and everything is back to normal.

The code for the drop is

 

@(Html.Kendo().DropDownList()

.Name("Name")

.OptionLabel("Select something...")

...

..BindoTo(new List>SelectListItem>

{

...

}}))

 

The code for the multiselect is

@(Html.Kendo.MultiSelect()

.Name("Something")

.PlaceHolde("Select something...")

...

.BindTo(new List<SelectListItem>

{

...

}}))

 

Any ideas?

Rui
Top achievements
Rank 1
 answered on 27 Jul 2017
5 answers
880 views
I have a Grid with template column columns.Bound(p => p.Category).ClientTemplate("#=Category.CategoryName#").Width(180);
When I edit this cell I get a dropdownlist and select values from the list.

Then I added ClientDetailTemplateId to grid and the above column is no more editable.
Could you please help
Stefan
Telerik team
 answered on 27 Jul 2017
3 answers
1.5K+ views

I need to refresh my PieChart using calculation made in my controller using a DatePicker.

Despite the update of the Viewbag used for the series in my controller, It seems that the series are not updated when refreshing the Chart.

Any suggestions ?

MyView :

@(Html.Kendo().DatePicker()
          .Name("startDatepicker")
          .Value(DateTime.Now.ToShortDateString())
          .Events(e =>
          {
            e.Change("onStartDateChange");
          }))
@(Html.Kendo().Chart()
      .Name("chartWorkDuration")
      .Title(title => title.Text("Working time - Total : " +
                                 ViewBag.TotalWorkDuration.ToString() + "h")
                            .Position(ChartTitlePosition.Bottom))
      .ChartArea(chart => chart.Background("transparent"))
      .Series(series => series.Pie(ViewBag.arWorkDuration)
              .Padding(0)
      )
      .Tooltip(tooltip => tooltip
          .Visible(true)
          .Format("{0:N0}")
      )
)
<script>
  function onStartDateChange() {
    var startDate = $("#startDatepicker").data("kendoDatePicker").value().toDateString();
    $.ajax({
      url: 'PlanningGraph/RefreshGraph',
      cache:false,
      data: {
        startDate: startDate
      },
      success: function (xhr, textStatus) {
        $("#chartWorkDuration").data("kendoChart").refresh();
      }
    });
    });
  }
</script>

My Controller

// Creation of my viewmodel elements
....
      var workDuration = graphElementViewModels.Select(w => new
        {
        category = w.strCategory,
        value = w.dblValue,
        color = w.strColor
        });
ViewData["arWorkDuration"] = workDuration;

 

Stefan
Telerik team
 answered on 27 Jul 2017
5 answers
196 views
I have a group-able Kendo grid with a pop-up editor. When the user clicks "New Entry" a new row is created in a new grouping even if the a group already exists for that value. Additionally, if the user clicks "Cancel" the incomplete row and its group is retained. If the user clicks "New Entry" again, the old incomplete entry is removed, but the group is retained.

How do I tell the Kendo Grid to not create a new row until the user has clicked OK for the new entry (and the entry has passed validation)? Is it possible to have this new row correctly placed in the appropriate grouping?

Thanks!
Vasil
Telerik team
 answered on 26 Jul 2017
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
Dialog
MultiColumnComboBox
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
Security
ColorPicker
DateRangePicker
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
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?