Cannot edit kendo grid after deploy the project on server - asp.net-mvc-4

I have a gird, that works normally while I'm working locally, but when I deploy the code on a server I cannot edit anymore the grid.
#(Html.Kendo().Grid<BussinessUnitDto>()
.Name("FunctionsGrid")
.AutoBind(true)
.Scrollable()
.ToolBar(toolBar =>
{
toolBar.Create();
toolBar.Save();
})
.Editable(editable => editable.Mode(GridEditMode.InCell).DisplayDeleteConfirmation(false))
.DataSource(ds=>ds.Ajax().Batch(true).ServerOperation(false)
.Read("GetDeliveryUnits","DeliveryUnits")
.Create("Editing_Create", "DeliveryUnits")
.Update("Editing_Update", "DeliveryUnits")
.Destroy("Editing_Destroy", "DeliveryUnits")
.Model(model =>
{
model.Id(m => m.UnitID);
})
)
.Columns(c =>
{
c.Bound(e => e.UnitName);
c.Command(com => com.Destroy());
}
))
If I'm looking with FireBug for example, I see that the input for editing cell is not created.
Does anyone know why this behaviour?
Thank you :)

Related

PrestaShop save HTML in CustomerMessage->message

I'm making a customization in a PrestaShop 1.6.0.14 where I need to offer an HTML editor when the employee answers to a customer thread. This part I achieved and the I'm getting to send the HTML in the e-mail message.
My problem is to show in the history, I need to show the HTML in the history (sometimes employees send links etc..). To achieve that I need to be able to save HTML in the message field of the customer_message table. When I go to the definition of the ObjectModel (classes/CustomerMessage.php) I see this:
'message' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 65000),
Which is cleaning the HMTL. So I created a new file at override/classes/CustomerMessage.php with this content:
class CustomerMessage extends CustomerMessageCore
{
public function __construct($id = null) {
self::$definition['fields']['message'] = array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'required' => true, 'size' => 65000);
parent::__construct($id);
}
}
This I believe that would override the property allowing me to save HTML in this field. But it doesn't work. Am I doing it the wrong way? If so, how can I redefine this field?
Thanks for any help
you have to use this settings:
self::$definition['fields']['message'] = array('type' => self::TYPE_HTML, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 65000);
the type should be TYPE_HTML, and don't change validation isCleanHtml because it check about parts of html code that you don't want (like js, script, iframe, etc)
Let me know :)
PS: Every time that we make an override, delete the class_index.php that is stored in cache folder

New page from HTML in kartik\mpdf (Yii2)

I have a problem. How to add a new page from HTML to PDF?
Immediately I will say that I do not know why, but solutions such as:
<pagebreak />
or
h1 {page-break-before: always}
not working.
My PHP Code:
$pdf = new Pdf([
'mode' => Pdf::MODE_UTF8,
'format' => Pdf::FORMAT_A4,
'orientation' => Pdf::ORIENT_PORTRAIT,
'destination' => Pdf::DEST_FILE,
'filename' => $path,
'content' => $content,
'cssInline' => '.font_next{font-family:DoodlePen}table{border-collapse:collapse;width:100%}td{border:1px solid #000}',
]);
return $pdf->render();
Does anyone have this experience and can help you?
From the docs, looks like you can either use HTML like:
<pagebreak />
or
<tocpagebreak />
Or PHP:
$mpdf->AddPage();
$mpdf->TOCpagebreak();
But you already said you tried the html and din't work. Maybe you have a parent element with float?
OK, it works.
I use this method: https://davidwalsh.name/css-page-breaks
In HTML:
<div className="page-break"></div>
In PHP:
$pdf = new Pdf([
'mode' => Pdf::MODE_UTF8,
'format' => Pdf::FORMAT_A4,
'orientation' => Pdf::ORIENT_PORTRAIT,
'destination' => Pdf::DEST_FILE,
'filename' => $path,
'content' => $content,
'cssInline' => '
#media all{
.font_next{font-family:DoodlePen}table{border-collapse:collapse;width:100%}td{border:1px solid #000}.page-break {display: none;}
}
#media print{
.page-break{display: block;page-break-before: always;}
}
',
]);
return $pdf->render();

how to bind Kendo grid custom command click event?

How can we use custom delete confirmation message box while working with Kendo UI Grid ?
I am working on ASP.NET MVC4 application.And below is the code of my Kendo Grid.
I want to use custom confirmation message box in place of default Destroy command confirmation box.And for that i am using custom command in place of Destroy command.
But my problem is i want to fire one serer side action method in .Datasource section(just like in below code for Destroy command),but i don't know how to fire that action with Custom command.
Can any one help me out on this ?
<script id="XYZTemplate" type="text/kendo-tmpl">
#(Html.Kendo().Grid<Gts.Core.Dto.XYZDto>()
.Name("XYZItem")
.Columns(columns =>
{
columns.Bound(e => e.ID).Width(97).ClientTemplate("<span style=\"float:left\">\\#=Number\\#</span>").HtmlAttributes(new { style = "text-align:left;" });
columns.Bound(e => e.Qty).Width(30);
//columns.Command(command => { command.Destroy(); });
columns.Command(command => command.Custom("Delete").Click("deleteRow"));
})
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(p => p.ID))
.Read(read => read.Action("Items_Read", "Product", new { ID = "#=ID#", productId = "#=FKProductID#" }))
//.Destroy(update => update.Action("Items_Destroy", "Product"))
)
// .Events(events =>
events.DataBound("dataBoundChild").Edit("dataBoundEdit").Remove("deleteProductItemChild").Save("datasourceChange"))
.Events(events => events.DataBound("dataBoundChild").Edit("dataBoundEdit").Save("datasourceChange"))
.Editable(editable => editable
.Mode(GridEditMode.InCell)
.DisplayDeleteConfirmation(false))
.ToClientTemplate()
)
</script>
In your deleteRow function, after the you removed the row from grid, use the following code to sync the grid. The sync function will fire server-side actions accordingly depends on the changes you have made to the grid.
$("#XYZItem").data("kendoGrid").dataSource.sync();

New uploaded picture is not appearing until you restart the application in edit mode

I have a project written in MVC 4.
I am using kendo grid for one of my partial view
below is a part of my code for my grid
columns.Bound(p => p.BrandID).Groupable(false).Title(MyResources.LabelBrandID).HeaderHtmlAttributes(new { style = "text-align:" + MyResources.HeaderDirection });
columns.Bound(p => p.BrandNameE).Title(MyResources.LabelBrandNameE).HeaderHtmlAttributes(new { style = "text-align:" + MyResources.HeaderDirection });
columns.Bound(p => p.BrandNameA).Title(MyResources.LabelBrandNameA).HeaderHtmlAttributes(new { style = "text-align:" + MyResources.HeaderDirection });
columns.Bound(p => p.BrandID).Width(120).Title(" ").Filterable(false).Sortable(false)
.ClientTemplate(#"<img onError='BrandImgNotFound(this);' src='" + Url.Content("~/Images/Brands/") + "#=data.BrandID#.jpg' />");
columns.Template(#<text></text>).Title(" ").ClientTemplate("<input type=file name='files' onchange='dataBound(this.value)' />").Width(280).Hidden(true);
columns.Command(command => { command.Edit().Text(MyResources.EditText).CancelText(MyResources.CancelText).UpdateText(MyResources.UpdateText); command.Destroy().Text(MyResources.Delete); });
My problem is when you are uploading picture in inline editing and store it in the folder by using File.Copy,
new picture in edit mode is not appearing until you restart the application.
although the new uploaded picture is available in the folder.
Any help is appreciated.

ZendDeveloperTools module not displaying a toolbar in ZF2 beta5

I'm trying to install the ZendDeveloperTools modules for ZF2 beta5. Here are the steps I followed so far:
-Successfully installed ZendSkeletonApplication.
-Downloaded the module into my ./vendor directory.
-Enabled the module in ./config/application.config.php:
<?php
return array(
'modules' => array(
'Application',
'ZendDeveloperTools', // Added this line
),
'module_listener_options' => array(
'config_glob_paths' => array(
'config/autoload/{,*.}{global,local}.php',
),
'module_paths' => array(
'./module',
'./vendor',
),
),
);
-Copied ./vendor/ZendDeveloperTools/config/zenddevelopertools.local.php.dist to ./config/autoload/zenddevelopertools.local.php.
-Edited zenddevelopertools.local.php as follows:
<?php
return array(
'zdt' => array(
'profiler' => array(
'enabled' => true,
'strict' => true,
'verbose' => true,
'flush_early' => false,
'cache_dir' => 'data/cache',
'collectors' => array(),
'verbose_listeners' => array('application' => array(
'ZDT_TimeCollectorListener' => true,
'ZDT_MemoryCollectorListener' => true,
))
),
'toolbar' => array(
'enabled' => true,
'auto_hide' => false,
'position' => 'bottom',
'version_check' => false,
'entries' => array(),
),
),
);
-Added define('REQUEST_MICROTIME', microtime(true)); in my ./public/index.php
-Replaced my ./composer.json with the one provided in the ZendDeveloperTools module.
-Removed the , at the end of line 29 which was causing problems (shouldn't be there):
-Ran a composer update :
$ php composer.phar update
Updating dependencies
- Updating zendframework/zendframework (dev-master)
Checking out 9f4dd7f13c8e34362340072d0e2d13efe15e4b1f
Writing lock file
Generating autoload files
-Added error_reporting(E_ALL); ini_set('display_errors', '1'); to ./public/index.php to catch potential errors
When I access my application I don't get any errors (I get the skeleton application home page) but the zend developer toolbar isn't show up
What am I missing to make use of and display the zend developer toolbar?
It was a stupid mistake, I had placed zenddevelopertools.local.php into ./config and not ./config/autoload. Above instructions are correct. Here is what the toolbar looks like for those who are curious:
Worked for me, but one change I had to make for my app was rename the config from:
zenddevelopertools.local.php
to:
zenddevelopertools.local.config.php
Also, I installed BjyProfiler, which "just worked" with my Doctrine2 setup (nice!). The only caveat was that I had to add the default SM factory config so it would stop throwing errors:
'service_manager' => array(
'factories' => array(
/**
* This default Db factory is required so that ZDT
* doesn't throw exceptions, even though we don't use it
*/
'Zend\Db\Adapter\Adapter' => function ($sm) use ($dbParams) {
$adapter = new BjyProfiler\Db\Adapter\ProfilingAdapter(array(
'driver' => 'pdo',
'dsn' => 'mysql:dbname=skunk;host=hunk',
'database' => 'bunk',
'username' => 'junk',
'password' => 'punk',
'hostname' => 'lunk',
));
$adapter->setProfiler(new BjyProfiler\Db\Profiler\Profiler);
$adapter->injectProfilingStatementPrototype();
return $adapter;
},
),
),
See the screenshot: