简体   繁体   English

如何使用AngularJS将人从DropDownList(ddl在表1上)移动到另一个表(表2)?

[英]How can I move a person from a DropDownList (the ddl is on table 1 ) to another table (table 2) using AngularJS?

This is my first post so please be kind with me. 这是我的第一篇文章,所以请对我好一点。 :D What i want is to select a person from a DropDownList (which is on table 1) and when i press a button, I want to move the selected person to another table (on table 2). :D我想要的是从DropDownList(在表1上)中选择一个人,当我按下一个按钮时,我想将所选的人移动到另一个表(在表2上)。 I will post some screens from my PC because i cant add code (i receive some error where say is too much code or something like that...) 我将在我的PC上发布一些屏幕,因为我无法添加代码(我收到一些错误,说代码太多或类似的东西...)

Here is the link with Photos. 这是与照片的链接。 I dont have 10 reputation so i cant post different URL with description...:D 我没有10个声誉,所以我不能张贴带有描述的不同URL ...:D

http://postimg.org/gallery/13lmzz4kq/ http://postimg.org/gallery/13lmzz4kq/

I write description in every photo :D 我在每张照片中都写了描述:D

Ty in advance ! 提前输入!

In your plunker you have a method moveAudit . 在您的插件中,您可以使用moveAudit方法。 This method receives an item: 此方法收到一个项目:

$scope.moveAudit = function (item) //Function for moving the unassigned audits
{
    //var assignedAudit = $scope.assignedAudit; //--> you dont need this here
    //var audit = $scope.unassignedAudit; //--> unused variable
    //var auditId = $scope.unassignedAudit.IdUnassignedAudit; //--> unused variable

    //TODO: here you need to add the selected 'expert' to item
    // inspect/debug how your form POST passes this information to the controller
    // ideally put it in a scoped var or pass it in the method: $scope.moveAudit = function (item, selectedExpert)
    item.AssignedExpert = $scope.selectedExpert

    //add to AssignedAudit 
    $scope.assignedAudit.push(item);
    console.log("Row added: ", $scope.assignedAudit);

    //TODO: probably you want to remove the item from $scope.assignmentExperts
};

I cannot debug the plunker since it is incomplete, but this should do the trick. 由于调试器不完整,因此无法调试,但这可以解决问题。

Upon further inspection of your code it looks like $scope.ddSelection is the selected expert. 在进一步检查您的代码后,看起来$scope.ddSelection是选定的专家。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM