grouperArray.sort(function (a, b) {
var aSize = a.gsize;
var bSize = b.gsize;
var aLow = a.glow;
var bLow = b.glow;
console.log(aLow + " | " + bLow);
return (aSize < bSize) ? -1 : (aSize > bSize) ? 1 : 0;
});
Run Code Online (Sandbox Code Playgroud)
所以上面的代码按gsize对数组进行排序 - 从最小到最大.它运作良好.但如果gsize是相同的,我希望它然后按发光排序.
谢谢.
<div class="selectedColumns" >
<a href="#" attributeid="19" >Driver License State</a>
<a href="#" attributeid="21" >Email</a>
<a href="#" attributeid="23" >Experience Level</a>
<a href="#" attributeid="26" >First Name</a>
<a href="#" attributeid="71" >Is Account Enabled</a>
<a href="#" attributeid="39" >Last Contacted Date</a>
<a href="#" attributeid="40" >Last Name</a>
<a href="#" attributeid="41" >Middle Name</a>
<a href="#" attributeid="6">Carrier</a>
</div>
Run Code Online (Sandbox Code Playgroud)
我有一系列链接.每个链接都有一个attributeid属性.我想按属性值过滤.所以在上面的链接中如果我的值为41,它将返回中间名链接.
var link = $('.selectedColumns a:[attributeid==' + $(this).val() + ']');
Run Code Online (Sandbox Code Playgroud)
这没用?
它不喜欢的部分是ngOnInit()中的get()方法.是的,"[ts]属性'get'在类型'AngularFirestoreDocument <{}>'上不存在."
我查看了这里:https://firebase.google.com/docs/firestore/query-data/get-data ,它显示了对单个文档使用get()方法,但它只是不喜欢我的方法?
import { Component, OnInit, Pipe } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Router, ActivatedRoute } from '@angular/router';
import { AngularFirestore, AngularFirestoreCollection, AngularFirestoreDocument } from 'angularfire2/firestore';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import { User } from './user';
@Component({
selector: 'user-form',
templateUrl: 'user-form.component.html'
})
export class UserFormComponent implements OnInit {
form: FormGroup;
title: string;
user = new User();
id;
userDoc: AngularFirestoreDocument<User>;
singleUser: Observable<User>;
constructor(fb: FormBuilder, …
Run Code Online (Sandbox Code Playgroud) firebase typescript angularfire2 angular google-cloud-firestore
我正在尝试通过代码创建并提交表单.下面有什么问题?
$('#btnPrintInvoicePerFile').on('click', function (event) {
event.preventDefault(); //stop link default
var componentInvoiceId = EberlsComponentInvoiceForm.componentInvoice.Id;
console.log(componentInvoiceId);
$('<form>', {
"id": "getInvoiceImage",
"html": '<input type="text" id="componentInvoicId" name="componentInvoicId" value="' + componentInvoiceId + '" />',
"action": window.siteRoot + 'ComponentInvoice/GetInvoiceImage/'
}).submit();
});
Run Code Online (Sandbox Code Playgroud) var selectColumns = new Array();
selectColumns[0] = { TableName: "DeploymentRosterView", ColumnName: "ArrivedOn" };
selectColumns[1] = { TableName: "DeploymentRosterView", ColumnName: "DepartedOn" };
selectColumns[2] = { TableName: "DeploymentRosterView", ColumnName: "RoleType" };
selectColumns[3] = { TableName: "DeploymentRosterView", ColumnName: "AdjusterFirstName" };
selectColumns[4] = { TableName: "DeploymentRosterView", ColumnName: "AdjusterLastName" };
Run Code Online (Sandbox Code Playgroud)
上面的工作是用JavaScript创建我的数组,但有没有更优雅的方式来编写上面的?像对象初始化器一样?就是想
<%: Html.ActionLink("Cancel", "Edit", "Users", new {id = " + userID + " }, null) %>
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,userId是一个变量.这种语法不对,它应该是什么?
<div id="dynamicTable" columns="26,40,41,21,71,39,23,19">
var columns = $('#dynamicTable').attr('columns'); var attributeIds = new Array(); attributeIds = columns.split(',');
这会创建一个字符串数组,我需要它们是int.最好的方法是什么?
var profileDataCalls = [];
profileDataCalls['Profile'] = GetUserAttributesWithDataByGroup;
profileDataCalls['Address'] = GetUserAddresses;
profileDataCalls['Phone'] = GetUserPhoneNumbers;
profileDataCalls['Certs'] = GetUserCertifications;
profileDataCalls['Licenses'] = GetUserLicenses;
profileDataCalls['Notes'] = GetUserNotes;
Run Code Online (Sandbox Code Playgroud)
我的问题是上面的JavaScript数组只有0的长度.我需要一个可以迭代的数组并保存键(字符串)和值?
var pq = attributes.SingleOrDefault(a => a.AttributeName == PasswordQuestion").AttributeValue;
Run Code Online (Sandbox Code Playgroud)
如果为null,上面的代码将抛出错误.处理这个问题的最佳方法是什么?下面的代码可行,但我不禁觉得有更优雅的方式?
var pq = (attributes.SingleOrDefault(a => a.AttributeName == "PasswordQuestion") != null) ? attributes.SingleOrDefault(a => a.AttributeName == "PasswordQuestion").AttributeValue : null;
Run Code Online (Sandbox Code Playgroud) 我有一个名为user的on对象,它有一个名为AttributeBag的字典类型的属性.
我想在"PasswordQuestion"的AttributeBag中提取Key并获取其值.
以下不正确......
var x = user.Find(a => a.AttributeBag.Key["PasswordQuestion"]).value;
Run Code Online (Sandbox Code Playgroud)
救命
arrays ×4
javascript ×4
jquery ×3
angular ×1
angularfire2 ×1
asp.net ×1
attributes ×1
filter ×1
firebase ×1
lambda ×1
null ×1
split ×1
typescript ×1