2012-03-23 89 views
0

我正在使用MVC 3,EF Model First在我的项目上。使用Jquery和MVC3将表中的选定行添加到另一个表中

在我的看法我有4个看起来很喜欢这些的表。

<div class="questionsForSubjectType"> 
      <table> 
       <thead> 
        <tr> 
        <th> 
         Title 
        </th> 
        </tr> 
       </thead> 
       <tbody> 
        <tr> 
         <td> 
         test 
        </td> 
        </tr> 
       </tbody> 
      </table>   
</div>  

用户应该能够选择并添加到另一个表让说该表如下:

<table id="CustomPickedQuestions> 


    /* <----- Questions that users chose from the other tables /* 

    </table> 

我所寻找的是,当一个用户在一排点击,该行应被删除并添加到CustomPickedQuestions,当该行被添加到该表时,用户也应该能够从CustomPickedQuestionsTable中删除它,然后该行将返回到之前的Table

我现在想知道如何在客户端jquery脚本的帮助下完成此任务。

+0

是否要执行如下操作:http://jqueryui.com/demos/droppable/#shopping-cart? – Artem 2012-03-23 14:25:06

+0

嗯,我正在寻找一些更有用的功能,就像我上面解释过的。后来它也假设能够删除自定义的问题。 – Obsivus 2012-03-23 14:32:02

+0

那么,只需用jquery克隆克隆dom对象,然后追加jquery append,像'$(“。questionsForSubjectType tr”)。click(function(){$(this).clone()。appendTo(“#CustomPickedQuestions tbody“)}); ' - 当行点击它将被复制到目标表 – Artem 2012-03-23 14:36:49

回答

0

您的代码中存在太多不相关的复杂问题(针对您提出的具体问题)。标题很好,但不是代码。使用最少量的代码/方法/属性(使用通用名称,即产品ID,产品名称等),而不是发布复杂的项目代码,尽可能简单地再现问题。我的教程的第3部分展示了如何做到这一点。请参阅http://www.asp.net/mvc/tutorials/javascript/working-with-the-dropdownlist-box-and-jquery/adding-a-new-category-to-the-dropdownlist-using-jquery-ui

+0

感谢您的通知我已经做了一个编辑 – Obsivus 2012-03-23 16:17:18

相关问题