使用MEF时是否有任何棱镜“后构建”事件或方法?(Are there any Prism “Post-build” Event or method while using MEF?)

我在一个类中有4个以上的导入属性,而一些代码至少需要执行4个属性

是否有任何PRISM或MEF事件可以帮助而不是在每个setter上放置通知然后检查空值?


I have 4+ imported properties in a class and some code that needs at least 4 properties to execute

Are there any PRISM or MEF events that would help instead of putting notify on each setter and then checking for nulls ?


原文:https://stackoverflow.com/questions/8301608
2024-03-26 15:03

满意答案

我发现的第一个也是最明显的错误是命令“add + = parseFloat(this.value);” 不起作用。

正确的功能如下:

function calculateRow() {
   alert("GAYA");
   console.log("2");
   var add = 0;
   $(".qty").each(function() {
       add += parseFloat($(this).val()); // <-- changed from this.value
       if (isNaN(add)) {
           $('#total').val("0");
       } else {
           $('#total').val(add.toFixed(2));
       }
   });
}

您还必须更改以下行

$('#detail').on('keyup', '.qty', calculateRow());

$('#detail').on('keyup', '.qty', calculateRow);

Tthe first and most obvious error I found was that the command "add += parseFloat(this.value);" does not work.

The correct functions would be the following:

function calculateRow() {
   alert("GAYA");
   console.log("2");
   var add = 0;
   $(".qty").each(function() {
       add += parseFloat($(this).val()); // <-- changed from this.value
       if (isNaN(add)) {
           $('#total').val("0");
       } else {
           $('#total').val(add.toFixed(2));
       }
   });
}

You also have to change the following row from

$('#detail').on('keyup', '.qty', calculateRow());

to

$('#detail').on('keyup', '.qty', calculateRow);

相关问答

更多

根据动态添加的字段计算值(Calculating values based on dynamically added fields)

下面的代码将通过单个块循环并获取值。 $(document).keyup(function() { // desired calculation : for curr_netto is [name='p_cnetto[]']" * [name="p_pvat[]"] // curr_brutto = ([name='p_cnetto[]']" * [name="p_pvat[]"]) / 100 * name="p_ilosc[]" var cnetto = 0; var...

jQuery不适用于动态添加的表格行(jquery doesn't work on dynamically added table rows)

你真正需要的是在整个代码中使用classes ,并使用event delegation监听dynamic elements上的事件。 这是一个示例解决方案: 的jsfiddle var $tbody = $('#count tbody'); $('.add_row_count').on('click', function() { event.preventDefault(); var $row = $tbody.find('tr').eq(0).clone(); $row.fi...

在servlet中获取动态添加的表值(Get the dynamically added table values in servlet)

当他们动态创建时,让它们看起来像"fromDate_1"和"toDate_1" ,相应的时间看起来像"fromTime_1"和"to_time_1" 然后下一个调度程序看起来像"fromDate_2"和"toDate_2" ,相应的时间看起来像"fromTime_2"和"to_time_2" 等等 然后在你的servlet中创建一个for循环来让它们像 for (int i=1;i<100;i++){ //i dont think so the max value will be larger t...

如何使用jquery计算动态添加的表行的值的值(how to count the values of the values of the dynamically added table rows using jquery)

我发现的第一个也是最明显的错误是命令“add + = parseFloat(this.value);” 不起作用。 正确的功能如下: function calculateRow() { alert("GAYA"); console.log("2"); var add = 0; $(".qty").each(function() { add += parseFloat($(this).val()); // <-- changed from this.value ...

在ajax中验证来自外部php的动态添加的表行值(Validating dynamically added table row values from external php in ajax)

这是因为您正在执行两个ajax调用,并且在更改a的值之前正在命中第二个if语句。 如何读取代码是: var a = "1"; if ($("#maintable tbody tr").length>0){ //some code here it goes through in order until: $.ajax({ //do this in the background, meanwhile keep executing the code on the p...

如何使用jquery删除jsp中新添加的行中的先前行值(how to remove the previous rows values in the newly added rows in jsp using jquery)

尝试 $clone_row = $('#FirstRow').clone(); $cloned_row.find("input").val(''); Try $clone_row = $('#FirstRow').clone(); $cloned_row.find("input").val('');

基于来自其他表的值计算(*)行(Count (*) rows based on values from other table)

编辑:好的第一次我误解了我希望现在我认为正确的问题。 如果我在下面的评论中是正确的,这应该适合你: SELECT COUNT(DISTINCT(rt.record_id)) AS COUNTED FROM record_table rt INNER JOIN record_values rv ON rt.record_id = rv.record_id WHERE rt.type_id = 1 AND (8 IN (SELECT rv2.field_id FROM record_v...

我动态添加的表行未出现在我的应用中(My dynamically added table rows are not appearing in my app)

要回答您的问题:您需要将TableLayout包装在ScrollView : <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TableLayout android:id="@+id...

jQuery-动态地将具有不同id的表行的输入值相乘(jQuery- Dynamically multiply input values of table rows with different id)

尝试使用带选择器的开头 , $(function(){ function setTotalCost(n){ var h=Number($('#hours_'+n).val()), m=Number($('#markup_'+n).val()), // taking 0 if empty r=Number($('#rate_'+n).val()); $('#totalcost_'+n).val(h*m*r); } ...

如何获取使用Jquery动态添加的HTML表行记录?(How to get the HTML Table row records which is added dynamically using Jquery?)

工作时尚 动态添加的元素,您必须以这种方式绑定事件。 $(document).on("click",'#queryTable tbody tr',function(){ alert($(this).html()); }); 仅显示td值 $(document).on("click",'#queryTable tbody tr',function(){ var tr=$(this); var firsttd=tr.find("td:first").text(); var ...

相关文章

更多

Solr参数(DisMax Event Facet)

一.DisMax 1.tie:query and init param for tiebreaker ...

storm事件管理器EventManager源码分析-event.clj

storm事件管理器定义在event.clj中,主要功能就是通过独立线程执行&quot;事件处理函数& ...

研磨设计模式之工厂方法模式(Factory Method)-模式讲解1

3.1 认识工厂方法模式(1)模式的功能 工厂方法的主要功能是让父类在不知道具体实现的情况下,完成自 ...

研磨设计模式之工厂方法模式(Factory Method)-模式讲解2

3.2 工厂方法模式与IoC/DI,IoC——Inversion of Control 控制反转, ...

研磨设计模式之工厂方法模式(Factory Method)-场景问题

1.1 导出数据的应用框架,考虑这样一个实际应用:实现一个导出数据的应用框架,来让客户选择数据的导出 ...

研磨设计模式之工厂方法模式(Factory Method)-模式讲解3

3.3 平行的类层次结构(1)什么是平行的类层次结构呢?简单点说,假如有两个类层次结构,其中一个类层 ...

研磨设计模式之工厂方法模式(Factory Method)-解决方案

2.1 工厂方法模式来解决 用来解决上述问题的一个合理的解决方案就是工厂方法模式。那么什么是工厂方法 ...

redhat6.4上build storm 0.9.0.1

1.安装mvn 2.下载源代码 3.build mvn package 过程中出现问题,clojars ...

struts1 怎么在action中获取页面post的参数

前台传的参数超过4k,method=post 在action中怎样接这个参数 String dat ...

【Hadoop】Build and Run HDFS

今天再一次配置HDFS,决定记录下来以备不时之需。 首先你的电脑需要安装上java JDK 1.6 这 ...

最新问答

更多

如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)

请尝试以下方法: $messages = $user->contact_messages()->paginate(10); Try the following: $messages = $user->contact_messages()->paginate(10);

linux的常用命令干什么用的

linux和win7不一样,win7都图形界面,都是用鼠标来操作打开,解压,或者关闭。而linux是没有图形界面的,就和命令提示符一样的一个文本框,操作linux里的文件可没有鼠标给你用,打开文件夹或者解压文件之类的操作都要通过linux常用命令。

由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)

它创建了这些视图: 'auth/login.blade.php', 'auth/register.blade.php', 'auth/passwords/email.blade.php', 'auth/passwords/reset.blade.php', 'layouts/app.blade.php', 'home.blade.php' 并修改这些文件: 'Http/Controllers/HomeController.php', 'routes/web.php' 如果使用--views

如何交换返回集中的行?(How to swap rows in a return set?)

您可以使用特殊的CASE表达式进行ORDER BY如下所示: SELECT * FROM table ORDER BY CASE id WHEN 3 THEN 8 WHEN 8 THEN 3 ELSE id END You can ORDER BY using a special CASE expression like this: SELECT * FROM table ORDER BY CASE id WHEN 3 THEN 8 WHEN 8 THEN 3 ELSE id END

在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)

我建议你制作一个新的TableView Cell,在这个newTableViewCell中,加载第2节中的所有单元格,然后为newTableViewCell提供边框。 但如果您不想这样做,那么您可以使用以下代码: @property(strong,nonatomic) CAShapeLayer* borderPath; -(void)viewDidLayoutSubviews{ [_borderPath removeFromSuperlayer]; UIView *viewToGiveBord

使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)

出于一些奇怪的原因,我现在发现了一个不同的问题, Boost.Spirit SQL语法/词法分析失败 ,其中提供了一些其他解决方案来进行空格跳过。 一个更好的! 以下是根据建议重新编写的示例代码: #include #include #include #include #include #incl

Java中的不可变类(Immutable class in Java)

1.如果我只有final变量的课程? 这会让你远离但不是全部。 这些变量的类型也需要是不可变的。 考虑一下 class MyImmutableClass { // final variable, referring to a mutable type final String[] arr = { "hello" }; // ... } 这允许有人做 myImmutableObject.arr[0] = "world"; 并有效地改变你的不可变类的对象。 此外,建议禁

WordPress发布查询(WordPress post query)

如果你想要在div中包含所有帖子: post_parent) { $myposts = get_posts('numberposts=10&tag=medical&order=DESC'); echo ' '; foreach ($myposts as $post): ?>

如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)

我不确定哪个是MySQL的正确答案,因为它本身还不支持IPv6地址格式(尽管“ WL#798:MySQL IPv6支持 ”表明它将在MySQL v6.0中,当前文档不支持)。 不过,你建议的人建议去2 * BIGINT,但要确保他们是UNSIGNED。 在IPv6的/ 64地址边界处有一种自然分割(因为/ 64是最小的网格块大小),这将与其很好地对齐。 I'm not sure which is the right answer for MySQL given that it doesn't y

是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)

您可以使用Object.keys和Array#find来获取匹配value的key 。 const letters = {a:'26',b:'25',c:'24',d:'23',e:'22',f:'21',g:'20',h:'19',i:'18',j:'17',k:'16',l:'15',m:'14',n:'13',o:'12',p:'11',q:'10',r:'9',s:'8',t:'7',u:'6',v:'5',w:'4',x:'3',y:'2',z:'1'}; function sw