如果未选中当前行,如何编辑当前行?我有一个batch启用的Kendo网格navigatable.我的目标是使用该dataItem.set()方法手动编辑列中的数据.但是,当您添加行时,它不会自动选中.因此,vm.testGrid.dataItem(vm.testGrid.select())不能使用.
vm.testGrid.dataSource.get(e.model.get("Id")) 获取新添加的行,但如果在保存之前添加了多行,它将始终获得第一个添加的行("Id"设置为自动增量并由数据库服务器自动生成,因此所有新创建的行最初将为0在保存之前).
vm.onEdit = function (e) {
$('input.k-input.k-textbox').blur(function (f) {
//var data = vm.testGrid.dataItem(vm.testGrid.select());
var data = vm.testGrid.dataSource.get(e.model.get("Id")); // will always get the firstly added row
data.set("LookupCol", "1000");
}
});
Run Code Online (Sandbox Code Playgroud)
有没有更好的解决方案来获取当前编辑的行?或者有更好的方法来编辑当前行吗?
我需要编写一个bash脚本,按排序顺序打印出命令行参数,每行一个.
我写了这个脚本,它工作正常,但还有其他方法吗?特别是没有将其输出到文件和排序.
#!/bin/bash
for var in $*
do
echo $var >> file
done
sort file
rm file
Run Code Online (Sandbox Code Playgroud)
测试运行程序:
$ script hello goodbye zzz aa
aa
goodbye
hello
zzz
Run Code Online (Sandbox Code Playgroud) 如果我按如下方式初始化列表,如何访问此结构中的元素:
group **list = (group **) malloc(sizeof(group));
typedef struct
{
// ID of the group, 'A' to 'D'
char id;
// a list of members in the group
char **members;
} group;
Run Code Online (Sandbox Code Playgroud)
我尝试使用(*list)->id = 'A'并编译,但在运行程序时出现分段错误错误.
我需要计算在这个递归函数中删除的文件数.由于它是递归的,我不能使用if语句,而C#不支持全局变量.任何替代品?
static void DirSearch(string path)
{
try
{
foreach (string dirPath in Directory.GetDirectories(path))
{
foreach (string filePath in Directory.GetFiles(dirPath))
{
string filename = Path.GetFileName(filePath);
if (filename.Equals("desktop.txt"))
{
File.Delete(filePath);
//count++
}
Console.WriteLine(filePath); // print files
}
Console.WriteLine(dirPath); // print directories
DirSearch(dirPath);
}
}
catch (System.Exception excpt)
{
Console.WriteLine(excpt.Message);
}
}
Run Code Online (Sandbox Code Playgroud) bash ×2
angularjs ×1
c ×1
c# ×1
counter ×1
delete-file ×1
javascript ×1
jquery ×1
kendo-grid ×1
malloc ×1
pointers ×1
recursion ×1
sorting ×1
struct ×1