我有一个x-editable输入,我用它来编辑用户名.元素的默认操作是单击自身时,可以编辑值.但是我想启用点击元素的.editable并能够编辑输入中的值.为了缩短在这里的东西是一个的jsfiddle我目前的状况.
jQuery的:
$(function(){
$.fn.editable.defaults.mode = 'inline';
$('#publicname-change').editable({
type: 'text',
url: '/post',
pk: 1,
placement: 'top',
title: 'Enter public name'
}
);
//ajax emulation. Type "err" to see error message
$.mockjax({
url: '/post',
responseTime: 100,
response: function(settings) {
if(settings.data.value == 'err') {
this.status = 500;
this.responseText = 'Validation error!';
} else {
this.responseText = '';
}
}
});
Run Code Online (Sandbox Code Playgroud)
HTML:
<div class="control-group control-group-inline">
<label class="control-label labelModified" for="publicname-change">Public name:</label>
<div class="controls">
<a href="#" id="publicname-change" class="editable editable-click inline-input">Mr. Doe</a>
<div class="edit">edit <i …Run Code Online (Sandbox Code Playgroud) 我在Python中的元组看起来像这样:
tuple = ('sparkbrowser.com', 0, 'http://facebook.com/sparkbrowser', 'Facebook')
Run Code Online (Sandbox Code Playgroud)
我想把它分开,这样我就可以从元组独立中得到所有项目,所以我可以这样做:
domain = "sparkbrowser.com"
level = 0
url = "http://facebook.com/sparkbrowser"
text = "Facebook"
Run Code Online (Sandbox Code Playgroud)
或类似的东西,我的需要是将每个项目分开.我尝试使用.split(",")元组,但我得到错误,说元组没有拆分选项
欢迎任何帮助或建议
有没有可能的方法来更改c3条形图中数据上方的标签位置?在官方文档中,很好地解释了如何通过操纵y和x整数来改变x和y测量轴上标签的位置,但我没有找到任何数据标签.
我试图指向它与普通的d3上c3是基础,但console.log返回我空:
d3.selectAll(".c3-texts .c3-text").each(function () {
var yOrigin = d3.select(this).attr('y');
console.log(yOrigin);
})
Run Code Online (Sandbox Code Playgroud)
因为它在图形生成之前触发.您可以在这里查看和编辑我正在处理的内容:http: //jsfiddle.net/e60o24d0/
我已经制作了一个力导向图,我想改变数据的节点形状,因为"entity":"company"它们将具有矩形形状,而没有这部分数据的其他数据将是现在的圆形.
你可以在这里看到我的工作示例只有圆形节点:http://jsfiddle.net/dzorz/uWtSk/
我试图if else在代码的一部分中添加带有语句的矩形,其中我将形状附加到节点,如下所示:
function(d)
{
if (d.entity == "company")
{
node.append("rect")
.attr("class", function(d){ return "node type"+d.type})
.attr("width", 100)
.attr("height", 50)
.call(force.drag);
}
else
{
node.append("circle")
.attr("class", function(d){ return "node type"+d.type})
.attr("r", function(d) { return radius(d.value) || 10 })
//.style("fill", function(d) { return fill(d.type); })
.call(force.drag);
}
}
Run Code Online (Sandbox Code Playgroud)
但是在任何节点上我都没有任何形状.
什么是正确的设置方法?
整个代码如下所示:脚本:
var data = {"nodes":[
{"name":"Action 4", "type":5, "slug": "", "value":265000},
{"name":"Action 5", "type":6, "slug": "", "value":23000},
{"name":"Action 3", "type":4, "slug": "", "value":115000}, …Run Code Online (Sandbox Code Playgroud) 我用d3.js插件创建了一个力导向图,我想根据它们所属的组为不同颜色的节点和标签着色.
我添加了颜色比例:
var color = d3.scale.category20();
Run Code Online (Sandbox Code Playgroud)
以及我添加的节点变量:
.style("fill", function(d) { return color(d.group); })
Run Code Online (Sandbox Code Playgroud)
但是所有节点都是相同的颜色..
这是我目前的情况:http://jsfiddle.net/WBkw9/
完整脚本:
var links = [
{source: "John", target: "Mike", group: "5"},
{source: "John", target: "Janice", group: "5"},
{source: "John", target: "Caleb", group: "5"},
{source: "John", target: "Anna", group: "4"},
{source: "John", target: "Tommy", group: "3"},
{source: "John", target: "Jack", group: "2"},
{source: "John", target: "Vilma", group: "1"},
];
var nodes = {};
// Compute the distinct nodes from the links.
links.forEach(function(link) { …Run Code Online (Sandbox Code Playgroud) 我有一个强制导向图,我想在鼠标上更改节点中的文本.我试图将数据"full_name":放入数据数组然后在鼠标悬停时调用它,就像我调用它来获取蓝色矩形图像一样.但它似乎不起作用,我没有得到任何错误.所以我不知道是什么问题..
您可以在此处查看和编辑示例:http://jsfiddle.net/dzorz/CqaLh/
和脚本看起来像这样:
var data = {"nodes":[
{"name":"Action 1", "type":2, "slug": "", "entity":"employee" },
{"name":"Action 2", "type":3, "slug": "", "entity":"employee" },
{"name":"Action 4", "type":5, "slug": "", "value":265000, "entity":"employee"},
{"name":"Action 5", "type":6, "slug": "", "value":23000, "entity":"employee"},
{"name":"Action 3", "type":4, "slug": "", "value":115000, "entity":"employee"},
{"name":"YHO", "full_name":"Yahoo", "type":1, "slug": "www.yahoo.com", "entity":"company", "img_hrefD":"http://img4host.net/upload/30143226522090da3be7a.jpg", "img_hrefL":"http://img4host.net/upload/30145118522095467b7e3.jpg"},
{"name":"GGL", "full_name":"Google", "type":1, "slug": "www.google.com", "entity":"company", "img_hrefD":"http://img4host.net/upload/30143226522090da3be7a.jpg", "img_hrefL":"http://img4host.net/upload/30145118522095467b7e3.jpg" },
{"name":"BNG", "full_name":"Bing", "type":1, "slug": "www.bing.com", "entity":"company", "img_hrefD":"http://img4host.net/upload/30143226522090da3be7a.jpg", "img_hrefL":"http://img4host.net/upload/30145118522095467b7e3.jpg" },
{"name":"YDX", "full_name":"Yandex", "type":1, "slug": "", "entity":"company", "img_hrefD":"http://img4host.net/upload/30143226522090da3be7a.jpg", …Run Code Online (Sandbox Code Playgroud) 所以,我正在使用强制定向图,我已经将我的节点上的.text更改为鼠标移到数据中的另一个文本.
我的代码看起来像这样:
脚本:
var data = {"nodes":[
{"name":"YHO", "full_name":"Yahoo", "type":1, "slug": "www.yahoo.com", "entity":"company", "img_hrefD":"", "img_hrefL":""},
{"name":"GGL", "full_name":"Google", "type":2, "slug": "www.google.com", "entity":"company", "img_hrefD":"", "img_hrefL":""},
{"name":"BNG", "full_name":"Bing", "type":2, "slug": "www.bing.com", "entity":"company", "img_hrefD":"", "img_hrefL":""},
{"name":"YDX", "full_name":"Yandex", "type":2, "slug": "www.yandex.com", "entity":"company", "img_hrefD":"", "img_hrefL":""},
{"name":"Desc1", "type":4, "slug": "", "entity":"description"},
{"name":"Desc2", "type":4, "slug": "", "entity":"description"},
{"name":"Desc4", "type":4, "slug": "", "entity":"description"},
{"name":"CEO", "prefix":"Mr.", "fst_name":"Jim", "snd_name":"Bean", "type":3, "slug": "", "entity":"employee"},
{"name":"ATT", "prefix":"Ms.", "fst_name":"Jenna", "snd_name":"Jameson", "type":3, "slug": "", "entity":"employee"},
{"name":"CTO", "prefix":"Mr.", "fst_name":"Lucky", "snd_name":"Luke", "type":3, "slug": "", "entity":"employee"},
{"name":"CDO", "prefix":"Ms.", …Run Code Online (Sandbox Code Playgroud) 我有强制有向图,有4种类型的节点和两种类型的链接.一种类型的节点(小蓝色节点)我用作两个较大节点之间的"连接节点".
在鼠标悬停节点上,它变得更大,但我也想以不同的颜色为这个节点着色"连接".所以,你将鼠标悬停在一个节点上...所有链接和小"连接节点"都会以不同的颜色显示,这样你就可以知道哪个更大的节点是这个连接的.
您可以通过以下链接查看我的情况:http://jsfiddle.net/2pdxz/
例如:如果您将鼠标悬停在Google节点上,则链接到Yahoo"连接"节点将突出显示,并链接到CDO并CTO突出显示
我试图添加这部分代码:
function fade(opacity)
{ link.style("opacity", function(d) {
return d.source === d || d.target === d ? 1 : opacity;
});
}
Run Code Online (Sandbox Code Playgroud)
我从其他问题中找到了类似的问题,但我不知道这对我有什么帮助,因为我对d3js说道.
确切的代码看起来像这样
脚本:
var data = {"nodes":[
{"name":"YHO", "full_name":"Yahoo", "type":1, "slug": "www.yahoo.com", "entity":"company", "img_hrefD":"", "img_hrefL":""},
{"name":"GGL", "full_name":"Google", "type":2, "slug": "www.google.com", "entity":"company", "img_hrefD":"", "img_hrefL":""},
{"name":"BNG", "full_name":"Bing", "type":2, "slug": "www.bing.com", "entity":"company", "img_hrefD":"", "img_hrefL":""},
{"name":"YDX", "full_name":"Yandex", "type":2, "slug": "www.yandex.com", "entity":"company", "img_hrefD":"", "img_hrefL":""},
{"name":"Desc1", "type":4, "slug": "", "entity":"description"}, …Run Code Online (Sandbox Code Playgroud) 我制作了一个脚本,可以在点击按钮时添加动态输入,并使用相应的x按钮删除不需要的输入.我需要在每个新创建的动态输入上添加x-editable插件.我正在使用x-editable,以这种方式,在x-editable弹出窗口中的选定选项上,右侧的输入获得与所选选项对应的值.
我已经使用静态元素进行了这项工作,但是使用动态元素我有很大的问题.首先,与所有html结构一起,使用其类名+动态字段数生成所有动态元素的类.确切地说,我正在使用配置的Fieldcount执行此操作:var FieldCount = 1;然后在生成html代码的部分中添加类似的内容class="privacy-dynamic'+ FieldCount +'".然后第一个动态元素在html代码中调用类privacy-dynamic2,第二个获取privacy-dynamic3,依此类推.
现在,我的第一个结论是我需要以某种方式为x-editable添加一个类似的选项,其中我将创建一个相同的脚本, + FieldCount +因此每个x-editable弹出窗口将对应于从左边的"结果输入"而不是一个弹出窗口所有动态输入.
我尝试以与生成html结构相同的方式生成x-editable脚本,但它没有用.傻傻的尝试,我知道,用脚本生成脚本,但我很绝望.
我真的不知道它是如何解决的,我是一个jquery菜鸟,我迷失了它.它能以某种方式解决吗?
下面是当前情况,其中第一个静态字段具有x-editable working,而动态字段具有相同的结构,可用于x-editable但没有脚本:http://jsfiddle.net/dzorz/QxMs7/
HTML:
<div class="container">
<input type="text" class="main_activity" id="main_activity" name="main_activity" placeholder="Main activity">
<div class="parentToDelegate">
<a href="#" id="privacy" class="privacy" data-type="select" data-pk="1" data-value="1" data-original-title="Select visibility">public</a>
<input type="text" id="privacy_result" class="privacy_result" value="1"/>
</div>
<div class="row">
<div id="InputsWrapper">
</div>
</div>
<div class="row">
<span id="AddMoreBox" class="btn btn-info pull-right"><i class="icon-plus"></i>Add More</span>
</div>
Run Code Online (Sandbox Code Playgroud)
脚本:
//x-editable
$('.privacy').editable({
showbuttons: …Run Code Online (Sandbox Code Playgroud) 我对使用来自 django-admin.py 的 Django 的 startproject 命令有点陌生,并且对这个命令给我的时间不足感到惊讶。虽然我有一个关于它的问题,但我在官方文档中找不到答案。
在我用于构建新项目的项目骨架文件夹中,我有两个文件夹,起始.(dot) sing 在 Linux 操作系统中使用,例如隐藏文件夹的标记。例子:
.hiddenFolder
|
----
|
file.js
|
file.cfg
|
file.html
Run Code Online (Sandbox Code Playgroud)
一次当我打:
django-admin startproject --template
/home/virt_env/project_env/project_folder/project_skeleton
--extension py,js,json myNewProject
Run Code Online (Sandbox Code Playgroud)
myNewProject 已生成,但那些隐藏文件夹.hiddenFolder及其中的.anotherHiddenFolder所有文件并未放置在新生成的项目中。
感觉他们被忽略了,我不知道我应该尝试指挥什么。是否有任何标志可以告诉命令
“不要忽略隐藏的文件夹和文件”
或者有什么替代解决方案?