ekondur / DatatableJS

Jquery datatable with entity framework using MVC html helper
MIT License
36 stars 15 forks source link

command onclick event in commands only uses numeric values but not strings. #123

Closed serkansmg closed 5 months ago

serkansmg commented 1 year ago

Describe the bug here is the table. Id column is Guid

var userTable = Html.JS().Datatable<redisUserModel>() .Name("redisUsers") .Columns(col => { col.Field(a => a.ServerName).Title("Server").Searchable(true); col.Field(a => a.UserName).Title("UserName").Searchable(true); col.Field(a => a.Id).Title("Id").Visible(false); col.Field(a => a.redisUser).Title("redisUser").Searchable(true) Template("(row.redisUser==null)?<span class=\"badge bg-danger\">Not Set:${data}"); col.Field(a => a.online).Title("online").Visible(true) .Template("(row.online!=true)?<span class=\"badge bg-danger\">OFFLINE:<span class=\"badge bg-green\">Online`"); col.Field(a => a.Id).Title("Id").Searchable(true) .Template("getButtons(row.redisUser,row.id)"); col.Commands(a => a.Id, new[] { new Command("<button class=\"btn btn-primary\"><span class=\"fas fa-user-check\"> Reset Perm","resetRedisUser"), new Command("<button class=\"btn btn-danger\"><span class=\"fas fa-user-minus\"> Del RUser","deleteRedisUser"), new Command("<button class=\"btn btn-warning\"><span class=\"fas fa-user-lock\"> Change Pwd","changePassword"), new Command("<button class=\"btn btn-green\"><span class=\"fas fa-server\"> Online Stats","getOnlineStatus"), new Command("<button class=\"btn btn-yellow\"><span class=\"fas fa-desktop\"> Device List","getdeviceStatus"), new Command("<button class=\"btn btn-secondary\"><span class=\"fas fa-server\"> Raw Sql","getRawSql"), new Command("<button class=\"btn btn-blue\"><span class=\"fas fa-bullseye\"> Ping Server","getPing") }, "Actions");

}) .Data("function(){var obj={serverName:selectedServer}; console.log('data:',JSON.stringify( obj)); return obj;}") .Language("/js/Turkish.json") .URL(Url.Action("getRedisServerUsers", "redisAdmin"), "POST", camelCase: true) .Processing(false).Searching(false).ColReorder(false) .ServerSide(true).Class("table table-striped table-bordered align-middle table-responsive dt-responsive") ;

`

each button only accepts function name but;

serkansmg commented 1 year ago

and also, how can i add printi, export, excel,csv, pdf buttons ? any example?

ekondur commented 5 months ago

Hello @serkansmg It was fixed and released with the 3.8.1 version. Thank you for your contribution.

By the way, print buttons are only for example to show buttons.