
I have a View with a Kendo TabStrip containing multiple grids on multiple panels. On one grid, I need to select the first row after loading data. I'm trying to do this with:
function publicUsersGridDataBound() { // Select the first row. var grid = $('#publicUsersGrid').data('kendoGrid'); grid.select("tr:eq(1)");};
This works when publicUsersGrid is the only grid on the View.
When I add more grids,
grid.select("tr:eq(1)");results in the first row in the first grid getting selected, not the first row in publicUsersGridDataBound, even though when I debug the javascript function, the line
var grid = $('#publicUsersGrid').data('kendoGrid');gets a reference to the correct grid.
I'm stumped.
TIA
This grid is working. It has a DropDownList in the muni_code column's EditorTemplate, which also works.
@(Html.Kendo().Grid<PublicUserMunicipality>() .Name("publicUserMunicipalitiesGrid") .Columns(columns => { columns.Bound(u => u.muni_code).EditorTemplateName("muni_codesList"); columns.Bound(u => u.SuperUser).ClientTemplate("<input type='checkbox' #= SuperUser ? checked='checked' : '' # ></input>"); columns.Bound(u => u.CanSubmitForms).ClientTemplate("<input type='checkbox' #= CanSubmitForms ? checked='checked' : '' # ></input>"); columns.Command(command => { command.Edit(); command.Destroy(); }).Width(180); }) .ToolBar(toolbar => toolbar.Create()) .DataSource(dataSource => dataSource .Ajax() .Model(model => model.Id(p => p.Id)) .Read(read => read.Action("PublicUserMunicipalitiesRead", "PublicUserMunicipalities") .Data("getSelectedPublicUserId")) .Create(create => create.Action("PublicUserMunicipalitiesCreate", "PublicUserMunicipalities")) .Update(update => update.Action("PublicUserMunicipalitiesUpdate", "PublicUserMunicipalities")) .Destroy(destroy => destroy.Action("PublicUserMunicipalitiesDestroy", "PublicUserMunicipalities")) ) )
I want to use the same DropDownList in non-edit mode. i.e. Have the ClientTemplate the same as the EditorTemplate.
I don't see the utility of posting the various failed attempts I've made to the
columns.Bound(u => u.muni_code).EditorTemplateName("muni_codesList");line so I'll stop here.
Thanks.
I have a popup editor template where I wish to have 2 update buttons instead of the standerd 1.
The first one is supposed to function as normally.
The second one is supposed to change a hidden value in the editor template and then trigger the grid update.
How would I go about:
1: adding the extra button next to the Update Button.
2: Updating the value in the "HiddenFor" object and then triggering the grid's Update Function?
In my BundleConfig.cs file I have the following...
bundles.Add(
new ScriptBundle("~/Scripts/JQueryUI").Include(
"~/Scripts/jqueryUI/jquery.js", // Jquery UI
"~/Scripts/jqueryUI/jquery-ui.min.js" // Jquery UI
)
);
bundles.Add(new StyleBundle("~/Content/JQueryCSS").Include(
"~/Content/jquery-ui.min.css" // Jquery UI CSS file
)
);
These files are to allow me to easily create a slide-out panel using the JQueryUI library which sits on top of the standard JQuery library.
Rendering the scripts in the Layout.cshtml file like this...
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryval")
@Scripts.Render("~/bundles/kendo")
@Styles.Render("~/Content/css")
@Styles.Render("~/Content/kendo/css")
@Scripts.Render("~/Scripts/leylascriptlibrary")
@Styles.Render("~/Content/JQueryCSS")
@Scripts.Render("~/Scripts/JQueryUI")
... results in the following error when the Grid is populated...
"TypeError: Object doesn't support property or method 'kendoGrid'\n at Anonymous function (Unknown script code:2:20)\n at fire (http://localhost/LeylaPublicWeb/Scripts/jqueryUI/jquery.js:3048:5)\n at add (http://localhost/LeylaPublicWeb/Scripts/jqueryUI/jquery.js:3094:7)\n at ready (http://localhost/LeylaPublicWeb/Scripts/jqueryUI/jquery.js:271:3)\n at init (http://localhost/LeylaPublicWeb/Scripts/jqueryUI/jquery.js:214:4)\n at jQuery (http://localhost/LeylaPublicWeb/Scripts/jqueryUI/jquery.js:63:3)\n at Global code (Unknown script code:2:2)\n at globalEval (http://localhost/LeylaPublicWeb/Scripts/jqueryUI/jquery.js:611:6)\n at domManip (http://localhost/LeylaPublicWeb/Scripts/jqueryUI/jquery.js:6281:9)\n at append (http://localhost/LeylaPublicWeb/Scripts/jqueryUI/jquery.js:6047:3)"
The grid never completes loading and the site just hangs.
There is something that clashes between the Kendo library and the JQueryUI library. Rearranging the order in which the scripts are rendered places the error elsewhere, but it still gives me an error.
Has anyone seen this before?
I am using the JQuery-ui library 1.11 downloaded from here: http://jqueryui.com/
how can get the spreadsheet from workbook if the workbook is created from to json?
public ActionResult MyAction(string data, string extension)
{
Workbook workbook = Workbook.FromJson(data);
// I need do something here with the spreadsheet
}
}
Hello,
it seems the hierarchy-function only works the first time. If i click on the symbol for another node the controller action fires, data comes back, but for whatever reason the grid doesn't show the data in the grid.
I'm not quite sure why this doesn't work, but to me it seems like tha grid doesn't refresh itself.
View:
@using DAKCrmImport.Web.Models;
@{
ViewBag.Title = "Index";
}
<h2>Profilübersicht</h2>
@(Html.Kendo().Grid<CrmProfileGridVM>().Name("grid-crmprofiles").BindTo(Model).Columns(c =>
{
//<a class='button-action grid-details' onclick='showProfile(this)' title='Details'>button details</a>
c.Template(t => { }).HeaderTemplate("")
.ClientTemplate(@"
<a class='button grid-button button-details' title='Details' id='bt-profile-details'>button details</a>
<a class='button grid-button button-delete' onclick='' title='Löschen' id='bt-profile-delete'>button delete</a>
<a class='button grid-button button-edit' onclick='' title='Bearbeiten' id='bt-profile-edit'>button edit</a>
<a class='button grid-button button-create' onclick='' title='Job erstellen' id='bt-profile-createjob'>button create</a>").Width(250);
c.Bound(i => i.Name);
c.Bound(i => i.JobCount);
c.Bound(i => i.UserGroup);
c.Bound(i => i.CreatedBy);
c.Bound(i => i.CreatedAt);
c.Bound(i => i.LastUpdatedBy);
c.Bound(i => i.LastUpdatedAt);
})
.ToolBar(toolBar => toolBar.Template("<a href='javascript: void(0)' class='button button-create2' title='Neues Profil anlegen' id='bt-profile-create'>button create</a>"))
.HtmlAttributes(new { style = "height: 680px;" })
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.Scrollable()
.ClientDetailTemplateId("template-grid-crmprofile")
.Groupable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Model(model => model.Id(p => p.Id))
.Read(r => r.Action("Read", "CrmProfile"))
))
<script id="template-grid-crmprofile" type="text/kendo-tmpl">
@(Html.Kendo().Grid<CrmJobGridVM>()
.Name("grid-crmjobs")
.Columns(c =>
{
c.Bound(j => j.CreatedBy);
c.Bound(j => j.JobStatus);
c.Bound(j => j.CreatedAt);
c.Bound(j => j.EndedAt);
c.Bound(j => j.CrmObjectCount);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Read(r => r.Action("GetJobsByProfileId", "CrmJob", new { profileId = "#=Id#" }))
)
.ClientDetailTemplateId("template-grid-crmjob")
.Pageable()
.Sortable()
.ToClientTemplate()
)
</script>
<script id="template-grid-crmjob" type="text/kendo-tmpl">
@(Html.Kendo().Grid<CrmObjectGridVM>()
.Name("grid-crmobjects")
.Columns(c =>
{
c.Template(t => { }).HeaderTemplate("").ClientTemplate("<a class='button grid-button button-details bt-object-details' title='Details'>button details</a>")
.Width(50);
c.Bound(o => o.OrdnungsbegriffTypString);
c.Bound(o => o.OrdnungsbegriffWert);
c.Bound(o => o.IsProcessedString);
c.Bound(o => o.Error);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Read(r => r.Action("GetObjectsByJobId", "CrmObject", new { jobId = "#=Id#" }))
)
.Pageable()
.Sortable()
.HtmlAttributes(new { @class = "gr-crmobjects" })
.ToClientTemplate()
)
</script>
Controller-Action:
public virtual ActionResult GetJobsByProfileId(int profileId, [DataSourceRequest] DataSourceRequest request)
{
return Json(Mapper.Map<CrmJobGridVM[]>(db.GetJobsByProfileId(profileId)).ToDataSourceResult(request));
}
I'd really appreciate some help.
I would rather not deploy all /content and /script files with my project. I only want to deploy the one language and the bootstrap theme with my project. Is there an easy way to accomplish this without just removing the unused themes and languages from the project?
Jim
Hello,
I'm new to the upload extension - I'm able to upload a file async in the App_Data folder but I have the following questions:
1. how to access the filenames which I have uploaded async in the [HttpPost] ActionResult?
(sync is no problem because I have the HttpPostedFileBase Parameter)
2. how to ensure that I have unique filenames?
3. I will save the files in my database after the HttpPost - might be a solution to save the the files in a Session variable or should I save them in the App_Data temporary
robert