为什么在JavaScript中以下结果为false:
10 === 000000010 (false)
Run Code Online (Sandbox Code Playgroud)
但结果如下:
010 === 000000010 (true)
Run Code Online (Sandbox Code Playgroud)
在所有情况下左右都是10,他们应该都是真的,不应该吗?
我在这里放了一个小提琴来证明这个问题.
http://jsfiddle.net/codeowl/fmzay/1/
只需删除一条记录,它应该回滚删除,因为我从destroy函数内部调用options.error.
为什么网格不会回滚?
问候,
斯科特
标记:
<div id="KendoGrid"></div>
Run Code Online (Sandbox Code Playgroud)
JS:
var _data = [
{ Users_ID: 1, Users_FullName: 'Bob Smith', Users_Role: 'Administrator' },
{ Users_ID: 2, Users_FullName: 'Barry Baker', Users_Role: 'Viewer' },
{ Users_ID: 3, Users_FullName: 'Bill Cow', Users_Role: 'Editor' },
{ Users_ID: 4, Users_FullName: 'Boris Brick', Users_Role: 'Administrator' }
],
_dataSource = new kendo.data.DataSource({
data: _data,
destroy: function (options) {
options.error(new Error('Error Deleting User'));
}
});
$('#KendoGrid').kendoGrid({
dataSource: _dataSource,
columns: [
{ field: "Users_FullName", title: "Full Name" },
{ …Run Code Online (Sandbox Code Playgroud) 我已经整理了一个小提琴,演示了在KendoUI 2013.1.319中,当编辑网格中的记录并按下编辑对话框上的"更新"按钮时,它实际上会引发传输创建事件,而不是更新事件,并且它会引发每次记录一次.
打开以下小提琴并按网格中第一条记录上的"编辑"按钮,然后按编辑对话框上的"更新"按钮,在控制台窗口中查看,您将看到我已记录所引发的事件和记录ID那是传递给事件的.
http://jsfiddle.net/codeowl/fakDC/
为什么会发生这种情况,我该如何解决?
问候,
斯科特
保持StackOverflow快乐的代码:
<div id="TestGrid"></div>
var _Data = [{ "SL_TestData_ID": "1", "SL_TestData_Number": "1", "SL_TestData_String": "Test", "SL_TestData_Date": "1971-12-19", "SL_TestData_DateTime": "1971-12-19 12:00:00", "SL_TestData_Time": "00:30:00", "SL_TestData_Boolean": "1" }, { "SL_TestData_ID": "2", "SL_TestData_Number": "22", "SL_TestData_String": "Test 2", "SL_TestData_Date": "2013-05-01", "SL_TestData_DateTime": "2013-05-01 03:05:22", "SL_TestData_Time": null, "SL_TestData_Boolean": "1" }, { "SL_TestData_ID": "3", "SL_TestData_Number": "55", "SL_TestData_String": "Test 3", "SL_TestData_Date": "2013-05-02", "SL_TestData_DateTime": "2013-05-02 05:33:45", "SL_TestData_Time": null, "SL_TestData_Boolean": "0" }, { "SL_TestData_ID": "10", "SL_TestData_Number": "1", "SL_TestData_String": "Test12", "SL_TestData_Date": "1971-12-19", "SL_TestData_DateTime": "1971-12-19 12:00:00", "SL_TestData_Time": "00:30:00", …Run Code Online (Sandbox Code Playgroud) 窗口上有一个按钮,窗口大小合适.我在按钮中放了一行,有一行和两列,并在第一列放置一个路径,在第二列放置一个文本框.
我的问题是我无法通过按钮拉伸网格.
以下是发生的事情:
这就是我想要发生的事情:
我有网格HorizontalAlignment ="Stretch",但它没有拉伸.我在这做错了什么?
这是代码:
<Window x:Class="GridInButtonIssue.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:GridInButtonIssue"
mc:Ignorable="d"
Title="MainWindow" Height="136.5" Width="269.839">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button x:Name="btn_SelectMode" Grid.Row="0" Margin="0,35,0,0" >
<Grid HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="6*" />
<ColumnDefinition Width="4*" />
</Grid.ColumnDefinitions>
<Canvas x:Name="svg2" Grid.Column="0" Width="25" Height="25" HorizontalAlignment="Center">
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0"/>
</Canvas.RenderTransform>
<Canvas x:Name="layer1">
<Canvas.RenderTransform>
<TranslateTransform X="-298.50531" Y="-576.33075"/>
</Canvas.RenderTransform>
<Ellipse xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Canvas.Left="298.6" Canvas.Top="576.4" Width="19.9" Height="19.9" x:Name="path4144" Fill="#FF951718" StrokeThickness="0.14452878" Stroke="#FFFD0000" StrokeMiterLimit="4" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" …Run Code Online (Sandbox Code Playgroud) 当使用自定义模板创建时,我似乎找不到在kendoui网格上启动的弹出添加和编辑表单上设置标题的简单方法.当我尝试以下示例时,Add和Edit操作在弹出窗口的标题栏中都有"Edit":
标记:
<script id="popup-editor" type="text/x-kendo-template">
<p>
<label>Name:<input name="name" /></label>
</p>
<p>
<label>Age: <input data-role="numerictextbox" name="age" /></label>
</p>
</script>
<div id="grid"></div>
Run Code Online (Sandbox Code Playgroud)
JavaScript的:
$("#grid").kendoGrid({
columns: [
{ field: "name" },
{ field: "age" },
{ command: "edit" }
],
dataSource: {
data: [
{ id: 1, name: "Jane Doe", age: 30 },
{ id: 2, name: "John Doe", age: 33 }
],
schema: {
model: { id: "id" }
}
},
editable: {
mode: "popup",
template: kendo.template($("#popup-editor").html())
},
toolbar: [{ name: 'create', …Run Code Online (Sandbox Code Playgroud) 我写了一个简单的Python程序:
#!/usr/bin/env python3.5
import sys, itertools
sCharacters = '123'
for iCombinationLength in range(0, len(sCharacters)+1):
for aCombination in itertools.combinations_with_replacement(sCharacters, iCombinationLength):
print(''.join(aCombination))
Run Code Online (Sandbox Code Playgroud)
输出如下:
1
2
3
11
12
13
22
23
33
111
112
113
122
123
133
222
223
233
333
Run Code Online (Sandbox Code Playgroud)
然而,如果它是数字 1、2 和 3 的所有组合,则需要包括:
311
312
313
321
322
323
331
332
333
Run Code Online (Sandbox Code Playgroud)
正如您在上面看到的,事实并非如此。我看过其他帖子给出的 Combinations_with_replacement 函数作为解决方案来获取传入的字符的所有可能组合。但这似乎并没有发生。我在这里做错了什么,如何获得字符变量中字符的所有可能组合?
谢谢你的时间 ;-)
我有一些HTML我附加到KendoUI Splitter容器,它有分配给它的bootstrap css.当HTML在拆分器外部时,样式工作正常,但在拆分器内部时它们会中断.
我怎么解决这个问题?
这是一个简单的小提琴,演示了这个问题:http: //jsfiddle.net/codeowl/9Ag3X/17/
这是代码:
<div class="spacer"></div>
<div id="StandardDiv">
</div>
<div class="spacer"></div>
<div id="splitter"
data-role="splitter"
data-panes="[
{ collapsible: false, size: '30px' },
{ collapsible: false }
]">
<div id="LeftPane"></div>
<div id="RightPane"></div>
</div>
<script id="TestTemplate">
<div class="panel panel-default">
<div class="panel-heading ma-panel-heading">Edit User Details:</div>
<div class="panel-body">
<table class="form-uiview-add_edit">
<tr>
<td>
<label >Username:</label>
<input type="text" class="form-control" />
</td>
<td>
<label >Password:</label>
<input type="password" class="form-control" />
</td>
</tr>
<tr>
<td>
<label >First Name:</label>
<input type="text" class="form-control" />
</td>
<td>
<label …Run Code Online (Sandbox Code Playgroud) 是否有全局方法可以关闭KendoUI中所有控件的动画.我想有一个选项可以这样做,所以如果有人使用低功耗设备,我们可以选择让他们在没有动画/过渡的情况下运行.
像kendo.enableAnimations(false);
问候,
斯科特
我有一个问题,剑道窗口没有正确居中.
这是一个简单的小提琴,演示了这个问题.因此,在没有浏览器垂直滚动条的情况下,kendo窗口可以显示空间,但是kendo窗口中心方法会将其置于中心位置,并强制浏览器滚动条显示.

小提琴:http://jsfiddle.net/codeowl/QKPN6/2/
HTML:
<div id="testWindow">
<p>here is the test content here is the test content</p>
<p>here is the test content here is the test content</p>
<p>here is the test content here is the test content</p>
<p>here is the test content here is the test content</p>
<p>here is the test content here is the test content</p>
<p>here is the test content here is the test content</p>
<p>here is the test content here is the test content</p>
<p>here …Run Code Online (Sandbox Code Playgroud) 在postgresql 9.5中,如何使用INSERT ... ON CONFLICT(id)DO UPDATE ...语法与序列ID一起使用?
在tbltest包含以下列的表中:
数据库中哪个tbltest_ID序列执行自动递增.
以下适用于更新,例如; 更新ID为4的记录:
INSERT INTO tbltest (
tbltest_ID,
tbltest_Name,
tbltest_Description)
VALUES
(4, 'test name','test description')
ON CONFLICT (tbltest_ID) DO UPDATE SET (
tbltest_Name,
tbltest_Description) = (
excluded.tbltest_Name,
excluded.tbltest_Description) RETURNING *;
Run Code Online (Sandbox Code Playgroud)
但是为了让DB为插入创建序列ID,我需要从语句中删除ID列:
INSERT INTO tbltest (
tbltest_Name,
tbltest_Description)
VALUES
('test name','test description')
ON CONFLICT (tbltest_ID) DO UPDATE SET (
tbltest_Name,
tbltest_Description) = (
excluded.tbltest_Name,
excluded.tbltest_Description) RETURNING *;
Run Code Online (Sandbox Code Playgroud)
如果我想更新一些新记录和一些现有记录,这就成了一个问题.好像我删除了ID列,它们都是插入的,如果我把它留在那里,我必须在VALUES数组中为每一行提供一个ID值,当我定义一个ID时,序列(db的自动增量) )不再使用.
如何INSFT ... ON CONFLICT(id)DO UPDATE ...语句spost与序列ID一起使用以插入/更新将包含新记录和现有记录的一组记录?
例如,以下内容不起作用: …
我有一个网格,并在顶部工具栏中添加了一个编辑按钮,它有铅笔图标.工具栏:["创建","编辑","保存","取消"]
但是,当我选择一行并按下它时,不会出现弹出编辑器.但是当我按下添加按钮时它会这样做.
我怎样才能做到这一点?
问候,
codeOwl
我在文档和演示中看到了一些示例,通过指定data-animation ="false",可以使用data-animation属性关闭窗口小部件上的动画.
我的问题是:如何定义动画的其他设置.例如:
{
animation: {
// fade-out current tab over 1000 milliseconds
close: {
duration: 1000,
effects: "fadeOut"
},
// fade-in new tab over 500 milliseconds
open: {
duration: 500,
effects: "fadeIn"
}
}
}
Run Code Online (Sandbox Code Playgroud)
我无法在任何地方找到有关如何使用data-animation属性定义动画配置的文档.
我有以下简单的代码,在try/catch中抛出错误,并在catch中处理错误.这按预期工作,并记录错误:
try {
throw new Error('Test Error');
} catch (err) {
console.log('Caught Error:');
console.log(err);
}
Run Code Online (Sandbox Code Playgroud)
然后我尝试下一个示例,其中代码抛出错误而不是我只是创建一个测试错误并抛出它,并且错误被抑制,但不在catch中处理:
try {
let test = 1 / 0;
} catch (err) {
console.log('Caught Error:');
console.log(err);
}
Run Code Online (Sandbox Code Playgroud)
在第二个示例中,没有记录任何内容.为什么是这样?
问候.
kendo-ui ×8
javascript ×3
kendo-grid ×3
animation ×2
button ×1
c# ×1
datasource ×1
grid ×1
kendo-window ×1
mvvm ×1
popup ×1
postgresql ×1
python ×1
python-3.x ×1
templates ×1
wpf ×1