$(document).ready(function () {
var table = $('#example').DataTable({
"language": {
"url": "tw.json"
}
});
});
照官網怎麼套繁體中文「Chinese-traditional.json」都有問題,結果就把檔案下來,用本機端去試,然後再然的「副檔名」改成 json 就搞定了...
繁體 官網說明:https://datatables.net/plug-ins/i18n/Chinese-traditional
官網:https://datatables.net/
大陸:http://datatables.club/
2016年8月19日 星期五
2016年8月18日 星期四
【LINQ】SELECT 兩個 欄位 tw column (第三種:Lambda select )
public IQueryable CompanyList()
{
IQueryable result = null;
result = from o in Context.Company
.Select
(
o => new { o.CodeName ,o.CodeValue}
)
select o;
return result;
}
解析後:
{SELECT
1 AS [C1],
[Extent1].[CodeName] AS [CodeName],
[Extent1].[CodeValue] AS [CodeValue]
FROM (
SELECT
[Company].[Id] AS [CodeTreeId],
[Company].[CodeName] AS [CodeName],
[Company].[CodeValue] AS [CodeValue],
[Company].[Sort] AS [Sort],
FROM [dbo].[Company] AS [Company]) AS [Extent1]}
{
IQueryable result = null;
result = from o in Context.Company
.Select
(
o => new { o.CodeName ,o.CodeValue}
)
select o;
return result;
}
解析後:
{SELECT
1 AS [C1],
[Extent1].[CodeName] AS [CodeName],
[Extent1].[CodeValue] AS [CodeValue]
FROM (
SELECT
[Company].[Id] AS [CodeTreeId],
[Company].[CodeName] AS [CodeName],
[Company].[CodeValue] AS [CodeValue],
[Company].[Sort] AS [Sort],
FROM [dbo].[Company] AS [Company]) AS [Extent1]}
【LINQ】Select 兩個 欄位 two column (第二種:更好解法 linq select new)
【LINQ】Select 兩個 欄位 two column (第二種:更好解法 linq select new)
【範例1】
public IQueryable CompanyList()
{
IQueryable result = null;
var q = from o in Context.Company
select new
{
o.CodeName,
o.CodeValue,
};
result = q.ToList().AsQueryable();
return result;
}
解析:
{System.Collections.Generic.List`1[<>f__AnonymousType0`2[System.String,System.String]]}
【範例2】
public IEnumerable CompanyList()
{
IEnumerable result = null;
var q = from o in Context.Company
select new
{
o.CodeName,
o.CodeValue,
};
result = q.ToList();
return result;
}
解析:
result = Count = 3
提供給 dropdownlist 或 radiobox 或 checkbox 使用
【範例1】
public IQueryable CompanyList()
{
IQueryable result = null;
var q = from o in Context.Company
select new
{
o.CodeName,
o.CodeValue,
};
result = q.ToList().AsQueryable();
return result;
}
解析:
{System.Collections.Generic.List`1[<>f__AnonymousType0`2[System.String,System.String]]}
【範例2】
public IEnumerable CompanyList()
{
IEnumerable result = null;
var q = from o in Context.Company
select new
{
o.CodeName,
o.CodeValue,
};
result = q.ToList();
return result;
}
解析:
result = Count = 3
提供給 dropdownlist 或 radiobox 或 checkbox 使用
【LINQ】Select new two column 只撈兩個欄位,再轉回CLASS 類型 (第一種)
【LINQ】Select new two column 只撈兩個欄位,再轉回CLASS 類型 (第一種)
以下這樣做法太麻煩了
public IQueryable CompanyList()
{
IQueryable result = null;
result = (from o in Context.Company
orderby o.Sort ascending
select new
{
CodeName = o.CodeName,
CodeValue = o.CodeValue,
}
).ToList()
.Select(x => new Company
{
CodeName = x.CodeName,
CodeValue = x.CodeValue,
}).AsQueryable();
return result;
}
{System.Linq.Enumerable+WhereSelectListIterator`2[<>f__AnonymousType0`2[System.String,System.String],Dcn.SqlClient.Company]}
以下這樣做法太麻煩了
public IQueryable
{
IQueryable
result = (from o in Context.Company
orderby o.Sort ascending
select new
{
CodeName = o.CodeName,
CodeValue = o.CodeValue,
}
).ToList()
.Select(x => new Company
{
CodeName = x.CodeName,
CodeValue = x.CodeValue,
}).AsQueryable();
return result;
}
{System.Linq.Enumerable+WhereSelectListIterator`2[<>f__AnonymousType0`2[System.String,System.String],Dcn.SqlClient.Company]}