$("#demo5").easyinsert({
name: ["", "keyWord", "", "bdRank", "", "ggRank"],
type: ["custom", "text", "custom", "text", "custom", "text"],
CID: ["", "keyWord", "", "bdRank", "", "ggRank"],
value: ["<strong style=\"color:#ff7b0e;\">关键词:</strong>", "", "<strong style=\"color:#ff7b0e;\">百度排名:</strong>", "", "<strong style=\"color:#ff7b0e;\">谷歌排名:</strong>", ""],
initValue:
initItemsValue
});initItemsValue 这个是AJAX从后台获取的数据,我按他所要求的数组格式,拼接好以后的数组值。但跟到easyinsert里面这个值没有成功解析,不知道要怎么样动态的初始化呢???initItemsValue的值是下面这样
[["<strong style=color:#ff7b0e;>关键词:</strong>", "fsdfsd", "<strong style=color:#ff7b0e;>百度排名:</strong>", "2", "<strong style=color:#ff7b0e;>谷歌排名:</strong>", "2"]
, ["<strong style=color:#ff7b0e;>关键词:</strong>", "43343", "<strong style=color:#ff7b0e;>百度排名:</strong>", "4", "<strong style=color:#ff7b0e;>谷歌排名:</strong>", "4"]
, ["<strong style=color:#ff7b0e;>关键词:</strong>", "fdbdfbdf", "<strong style=color:#ff7b0e;>百度排名:</strong>", "2", "<strong style=color:#ff7b0e;>谷歌排名:</strong>", "2"]]如果我直接把这个写成这样就没问题
$("#demo5").easyinsert({
name: ["", "keyWord", "", "bdRank", "", "ggRank"],
type: ["custom", "text", "custom", "text", "custom", "text"],
CID: ["", "keyWord", "", "bdRank", "", "ggRank"],
value: ["<strong style=\"color:#ff7b0e;\">关键词:</strong>", "", "<strong style=\"color:#ff7b0e;\">百度排名:</strong>", "", "<strong style=\"color:#ff7b0e;\">谷歌排名:</strong>", ""],
initValue:
[["<strong style=color:#ff7b0e;>关键词:</strong>", "fsdfsd", "<strong style=color:#ff7b0e;>百度排名:</strong>", "2", "<strong style=color:#ff7b0e;>谷歌排名:</strong>", "2"]
, ["<strong style=color:#ff7b0e;>关键词:</strong>", "43343", "<strong style=color:#ff7b0e;>百度排名:</strong>", "4", "<strong style=color:#ff7b0e;>谷歌排名:</strong>", "4"]
, ["<strong style=color:#ff7b0e;>关键词:</strong>", "fdbdfbdf", "<strong style=color:#ff7b0e;>百度排名:</strong>", "2", "<strong style=color:#ff7b0e;>谷歌排名:</strong>", "2"]]
});
但问题是我的是动态的值
name: ["", "keyWord", "", "bdRank", "", "ggRank"],
type: ["custom", "text", "custom", "text", "custom", "text"],
CID: ["", "keyWord", "", "bdRank", "", "ggRank"],
value: ["<strong style=\"color:#ff7b0e;\">关键词:</strong>", "", "<strong style=\"color:#ff7b0e;\">百度排名:</strong>", "", "<strong style=\"color:#ff7b0e;\">谷歌排名:</strong>", ""],
initValue:
initItemsValue
});initItemsValue 这个是AJAX从后台获取的数据,我按他所要求的数组格式,拼接好以后的数组值。但跟到easyinsert里面这个值没有成功解析,不知道要怎么样动态的初始化呢???initItemsValue的值是下面这样
[["<strong style=color:#ff7b0e;>关键词:</strong>", "fsdfsd", "<strong style=color:#ff7b0e;>百度排名:</strong>", "2", "<strong style=color:#ff7b0e;>谷歌排名:</strong>", "2"]
, ["<strong style=color:#ff7b0e;>关键词:</strong>", "43343", "<strong style=color:#ff7b0e;>百度排名:</strong>", "4", "<strong style=color:#ff7b0e;>谷歌排名:</strong>", "4"]
, ["<strong style=color:#ff7b0e;>关键词:</strong>", "fdbdfbdf", "<strong style=color:#ff7b0e;>百度排名:</strong>", "2", "<strong style=color:#ff7b0e;>谷歌排名:</strong>", "2"]]如果我直接把这个写成这样就没问题
$("#demo5").easyinsert({
name: ["", "keyWord", "", "bdRank", "", "ggRank"],
type: ["custom", "text", "custom", "text", "custom", "text"],
CID: ["", "keyWord", "", "bdRank", "", "ggRank"],
value: ["<strong style=\"color:#ff7b0e;\">关键词:</strong>", "", "<strong style=\"color:#ff7b0e;\">百度排名:</strong>", "", "<strong style=\"color:#ff7b0e;\">谷歌排名:</strong>", ""],
initValue:
[["<strong style=color:#ff7b0e;>关键词:</strong>", "fsdfsd", "<strong style=color:#ff7b0e;>百度排名:</strong>", "2", "<strong style=color:#ff7b0e;>谷歌排名:</strong>", "2"]
, ["<strong style=color:#ff7b0e;>关键词:</strong>", "43343", "<strong style=color:#ff7b0e;>百度排名:</strong>", "4", "<strong style=color:#ff7b0e;>谷歌排名:</strong>", "4"]
, ["<strong style=color:#ff7b0e;>关键词:</strong>", "fdbdfbdf", "<strong style=color:#ff7b0e;>百度排名:</strong>", "2", "<strong style=color:#ff7b0e;>谷歌排名:</strong>", "2"]]
});
但问题是我的是动态的值
这里需要用同步方式去获取数据,以保证数据加载完成后再执行下面的操作。
看下面文章
http://blog.csdn.net/y_h_t/archive/2010/08/30/5849546.aspx
插件里的$.isArray(o.initValue)
这里认为我拼接传入的类型不是数组而是字符串
hoho 搞定