jQuery UI多重排序列:滚动问题(jQuery UI multiple sortable columns : issue with scrolling)
jQuery:1.9.1
jQuery UI:1.10.1
<td class="my-column" > <div id="my-div1" class="my-div-class"> <p class="para-item"> para 101 </p> </div> </td> <td> <div id="my-div1" class="my-div-class"> <p class="para-item"> para 201 </p> </div> </td> <script> $(".my-div-class").sortable( { connectWith: '.my-div-class' } ); </script>
在小提琴中,当用户尝试将列表1中的顶部项目拖动到列表2的底部时,列表1的滚动条被移动而不是列表2的滚动条。
尝试各种事情,但无法使其正常工作。 任何输入/建议都非常感谢。
谢谢,拉克什
jQuery : 1.9.1
jQuery UI : 1.10.1
<td class="my-column" > <div id="my-div1" class="my-div-class"> <p class="para-item"> para 101 </p> </div> </td> <td> <div id="my-div1" class="my-div-class"> <p class="para-item"> para 201 </p> </div> </td> <script> $(".my-div-class").sortable( { connectWith: '.my-div-class' } ); </script>
In the fiddle, when user tries to drag top item in list-1 into bottom of list-2, the scroll bar of list-1 gets moved instead of list-2 scroll bar.
Tried various things but couldnt make it to work properly. Any inputs/suggestions are much appreciated.
Thanks, Rakesh
原文:https://stackoverflow.com/questions/16794882
最满意答案
尝试一下:
op <- merge(df1,df2, all.x = TRUE, all.y = TRUE) op$df1 <- 1*(op$V1 %in% df1$V1) op$df2 <- 1*(op$V1 %in% df2$V1) > op V1 df1 df2 1 A0A061ACH4;Q95Q10;Q9U1W6 1 1 2 A0A061ACL3;Q965I6;O76618 1 1 3 A0A061ACR1;Q2XN02;F5GUA3;Q22498 1 1 4 A0A061AJJ3;A0A061AEA8 1 1 5 A0A061AL01 1 1 6 C1P641 1 0 7 H2FLH3;H2FLH2;A0A061ACT3;A0A061AE24;Q23551-2;Q23551;Q23551-4;Q23551-3;Q23551-5 1 1 8 Q22501;A0A061AE05 1 1 9 Q86CZ7 1 1 10 Q27GQ4 0 1
要么
library(dplyr) op <- merge(df1,df2, all.x = TRUE, all.y = TRUE) %>% mutate(df1=1*(V1 %in% df1$V1), df2=1*(V1 %in% df2$V1))
以下是您的额外问题的答案:
- 知道df1和df2有多少行相似?
sum(df1$V1 %in% df2$V1)
-df1中存在多少df1?
sum(!(df1$V1 %in% df2$V1))
-df2中存在多少df2中不存在的df2?
sum(!(df2$V1 %in% df1$V1))
Try this out:
op <- merge(df1,df2, all.x = TRUE, all.y = TRUE) op$df1 <- 1*(op$V1 %in% df1$V1) op$df2 <- 1*(op$V1 %in% df2$V1) > op V1 df1 df2 1 A0A061ACH4;Q95Q10;Q9U1W6 1 1 2 A0A061ACL3;Q965I6;O76618 1 1 3 A0A061ACR1;Q2XN02;F5GUA3;Q22498 1 1 4 A0A061AJJ3;A0A061AEA8 1 1 5 A0A061AL01 1 1 6 C1P641 1 0 7 H2FLH3;H2FLH2;A0A061ACT3;A0A061AE24;Q23551-2;Q23551;Q23551-4;Q23551-3;Q23551-5 1 1 8 Q22501;A0A061AE05 1 1 9 Q86CZ7 1 1 10 Q27GQ4 0 1
OR
library(dplyr) op <- merge(df1,df2, all.x = TRUE, all.y = TRUE) %>% mutate(df1=1*(V1 %in% df1$V1), df2=1*(V1 %in% df2$V1))
And here are the answers for your extra questions:
-know how many lines from df1 and df2 are similar?
sum(df1$V1 %in% df2$V1)
-how many of df1 exist which don't exist in df2?
sum(!(df1$V1 %in% df2$V1))
-how many of df2 exist which don't exist in df1?
sum(!(df2$V1 %in% df1$V1))
相关问答
更多-
比较两列中的字符串并确保它们的子字符串不相同(compare strings from two columns and make sure their substrings are not the same)[2023-06-27]
select * from tab WHERE substring_index(location1,' ',1)<> substring_index(location1,' ',1) 你不应该比较Location1和Location2吗? 我建议保持单词的大小写与你的表格相同。 IE使用Location而不是location。 select * from tab WHERE substring_index(location1, '', 1) <> substring_index(location1, '', ... -
尝试一下: op <- merge(df1,df2, all.x = TRUE, all.y = TRUE) op$df1 <- 1*(op$V1 %in% df1$V1) op$df2 <- 1*(op$V1 %in% df2$V1) > op V1 df1 df2 1 ...
-
使用componentsSeperatedByString分隔字符串:使用任何字符串分隔单词(逗号,空格)并将结果放入NSSet。 对两个字符串执行此操作并比较集合是否相等。 使用mutableArray而不是Set的修改方法考虑到重复字符串的问题(如注释中所述): -(BOOL) string: (NSString*) string1 isEqualTo: (NSString*) string2 { if (string1.length != string2.length) return NO; ...
-
如果速度是您所关心的,则在获取数据时可以使用Dictionary而不是Lists/Arrays // Key (string) - String value // Value (int) - repeat count Dictionary
values = new Dictionary (); // Fill values: adding up v1, removing v2 using (IDataReader reader = myQuery.Exe ... -
如果你的字符串是唯一的(并且永远是唯一的),那么将它作为唯一的列和主键就可以了。 我使用单独ID的唯一原因是 它将来会在某个时刻变得不独特; 要么 如果它是一个大字符串,并且您希望另一个表列引用它(外键)。 我会将YAGNI原则应用于这两种情况,并在发生时对其进行担心。 另外,对于数据库应用程序,最好不要“在保存之前检查它是否已经存在”。 我倾向于只是尝试保存它并捕获错误,如果它存在。 由于它是主键(或唯一约束),因此可行。 检查存在然后插入经常导致竞争条件。 If your string is uniqu ...
-
使用refinr包比较和优化单独列中的字符串(Compare and refine strings in separate columns with refinr package)[2023-07-30]
我不确定这是refinr的最佳用法,它主要用于统一单列中的单词拼写。 你想要做什么看起来像一个模糊的联合,并有一个R包 。 使用的一个例子可能是: library(tidyverse) library(fuzzyjoin) df1 <- tribble( ~uid, ~name, ~value, "A", "Red", 13, "A", "violet", 145, "B", "Blue", 3, "B", "yellow", 56, "C", "yellow-purple", ... -
比较字符串(Compare strings)[2022-12-09]
你的morse变量似乎改变的原因是因为它指向了堆栈上的一个区域。 它指向堆栈区域的原因是因为您为其分配了参数english的地址,当您调用函数时它被压入堆栈,然后在函数完成后弹出堆栈。 现在你的莫尔斯变量将指向堆栈中相同位置的内存,这将在程序的整个生命周期中不断变化。 在我看来,解决这个问题的最好方法是从EnglishToMorse返回一个NULL指针,如果该字符不是AZ ...然后检查你的isMorse函数中的NULL指针。 毕竟,最好在代码中检查NULL指针。 char* EnglishToMorse( ... -
如何在R中有效比较两个不同的列(都包含字符串)?(How to compare two different columns(both contains string) efficiently in R?)[2023-11-05]
这个功能 phrasesWithWords <- function(x, table) { words <- strsplit(x, "\\W") found <- relist(unlist(words) %in% table, words) which(sapply(found, any)) } 在你的短语和可接受的单词表上工作: phrase <- c("I am fine", "He is fine", "am better", "better butter", ... -
比较两个以上的字符串(compare more than two strings)[2022-03-26]
替换线 if(!strcmp(Entered_Password, (set_password1||set_password2||set_password3||set_password4||set_password5)) 同 if (!(strcmp(Entered_Password, set_password1) && strcmp(Entered_Password,set_password2) && (strcmp(Entered_Password,set_password3) && strcmp(En ... -
这使用列表理解,因此它可能不是最快的解决方案,但工作简洁。 df['C'] = pd.Series(['Yes' if a in b else 'No' for a,b in zip(df['A'],df['B'])]) 编辑:如果您不想将值保留在C而不是用'否'覆盖它们,您可以这样做: df['C'] = pd.Series(['Yes' if a in b else c for a,b,c in zip(df['A'],df['B'], df['C'])]) This uses list compr ...