App.Globals.wrapRenderer = function(val) {
return '<div style="white-space:normal !important;">' + val + '</div>';
}
потім використовуємо:
...
{
header: "Описание",
dataIndex: "DESCRIPTION",
renderer: App.Globals.wrapRenderer,
width: 200
},
...
App.Globals.wrapRenderer = function(val) {
return '<div style="white-space:normal !important;">' + val + '</div>';
}
...
{
header: "Описание",
dataIndex: "DESCRIPTION",
renderer: App.Globals.wrapRenderer,
width: 200
},
...
Ext.override(Ext.data.Connection, {
request: Ext.data.Connection.prototype.request.createSequence(function(o) {
if (!o.failure) {
o.failure = function(response) {
var msg = "Unknown server error";
var resp = Ext.decode(response.responseText);
if (resp && resp.Message) {
msg = resp.Message;
}
Ext.Msg.show({
title: "Server Error",
msg: msg,
minWidth: 300,
buttons: Ext.Msg.OK,
icon: Ext.Msg.ERROR
});
}
}
})
});
CREATE PROCEDURE [TestTable_GetPagedAndSortedAndFiltered]
(
@startRowIndex int,
@maximumRows int,
@order nvarchar(50),
@ID int = null,
@Name nvarchar(50) = null,
@Size int = null,
@From datetime = null,
@To datetime = null
)
AS
BEGIN
declare @lastKey int
declare @lastAsc sql_variant
declare @lastDesc sql_variant
set rowcount @startRowIndex
select
@lastAsc = OrderAsc,
@lastDesc = OrderDesc,
@lastKey = OrderKey
from
(
select *,
ID as OrderKey,
case @order
when 'ID' then cast(ID as sql_variant)
when 'Name' then cast(Name as sql_variant)
when 'Size' then cast(Size as sql_variant)
when 'Created' then cast(Created as sql_variant)
else ID
END as OrderAsc,
case @order
when 'ID DESC' then cast(ID as sql_variant)
when 'Name DESC' then cast(Name as sql_variant)
when 'Size DESC' then cast(Size as sql_variant)
when 'Created DESC' then cast(Created as sql_variant)
END as OrderDesc
from TestTable
where
((@ID is null) or (@ID = ID))
and
((@Name is null) or (Name like @Name))
and
((@Size is null) or (@Size = Size))
and
((@From is null) or (@From < Created))
and
((@To is null) or (dateadd(day,1,@To) > Created))
) as T
order by OrderAsc,OrderDesc desc,OrderKey
set rowcount @maximumRows
select *
from
(
select *,
ID as OrderKey,
case @order
when 'ID' then cast(ID as sql_variant)
when 'Name' then cast(Name as sql_variant)
when 'Size' then cast(Size as sql_variant)
when 'Created' then cast(Created as sql_variant)
else ID
END as OrderAsc,
case @order
when 'ID DESC' then cast(ID as sql_variant)
when 'Name DESC' then cast(Name as sql_variant)
when 'Size DESC' then cast(Size as sql_variant)
when 'Created DESC' then cast(Created as sql_variant)
END as OrderDesc
from TestTable
where
((@ID is null) or (@ID = ID))
and
((@Name is null) or (Name like @Name))
and
((@Size is null) or (@Size = Size))
and
((@From is null) or (@From < Created))
and
((@To is null) or (dateadd(day,1,@To) > Created))
)as T
where
(
@lastAsc is null
and
@lastDesc is null
and
@lastKey is null
)
or
(
@lastAsc is not null
and
(
OrderAsc > @lastAsc
or
OrderAsc = @lastAsc
and
OrderKey >= @lastKey
)
)
or
(
@lastDesc is not null
and
(
OrderDesc < @lastDesc
or
OrderDesc = @lastDesc
and
OrderKey >= @lastKey
)
)
order by OrderAsc,OrderDesc desc,OrderKey
set rowcount 0
END
CREATE TABLE [TestTable](
[ID] [int] PRIMARY KEY IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NULL,
[Size] [int] NULL,
[Created] [datetime] NULL
)
CREATE PROCEDURE [TestTable_GetPagedAndSorted]
(
@startRowIndex int,
@maximumRows int,
@order nvarchar(50)
)
AS
BEGIN
declare @lastKey int
declare @lastAsc sql_variant
declare @lastDesc sql_variant
set rowcount @startRowIndex
select
@lastAsc = OrderAsc,
@lastDesc = OrderDesc,
@lastKey = OrderKey
from
(
select *,
ID as OrderKey,
case @order
when 'ID' then cast(ID as sql_variant)
when 'Name' then cast(Name as sql_variant)
when 'Size' then cast(Size as sql_variant)
when 'Created' then cast(Created as sql_variant)
else ID
END as OrderAsc,
case @order
when 'ID DESC' then cast(ID as sql_variant)
when 'Name DESC' then cast(Name as sql_variant)
when 'Size DESC' then cast(Size as sql_variant)
when 'Created DESC' then cast(Created as sql_variant)
END as OrderDesc
from TestTable
) as T
order by OrderAsc,OrderDesc desc,OrderKey
set rowcount @maximumRows
select *
from
(
select *,
ID as OrderKey,
case @order
when 'ID' then cast(ID as sql_variant)
when 'Name' then cast(Name as sql_variant)
when 'Size' then cast(Size as sql_variant)
when 'Created' then cast(Created as sql_variant)
else ID
END as OrderAsc,
case @order
when 'ID DESC' then cast(ID as sql_variant)
when 'Name DESC' then cast(Name as sql_variant)
when 'Size DESC' then cast(Size as sql_variant)
when 'Created DESC' then cast(Created as sql_variant)
END as OrderDesc
from TestTable
)as T
where
(
@lastAsc is null
and
@lastDesc is null
and
@lastKey is null
)
or
(
@lastAsc is not null
and
(
OrderAsc > @lastAsc
or
OrderAsc = @lastAsc
and
OrderKey > @lastKey
)
)
or
(
@lastDesc is not null
and
(
OrderDesc < @lastDesc
or
OrderDesc = @lastDesc
and
OrderKey > @lastKey
)
)
order by OrderAsc,OrderDesc desc,OrderKey
set rowcount 0
END
CREATE TABLE [TestTable](
[ID] [int] PRIMARY KEY IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NULL,
[Size] [int] NULL,
[Created] [datetime] NULL
)
declare @order nvarchar(50)
set @order = 'Created DESC'
select *
from TestTable
order by
case @order
when 'ID' then cast(ID as sql_variant)
when 'Name' then cast(Name as sql_variant)
when 'Size' then cast(Size as sql_variant)
when 'Created' then cast(Created as sql_variant)
END,
case @order
when 'ID DESC' then cast(ID as sql_variant)
when 'Name DESC' then cast(Name as sql_variant)
when 'Size DESC' then cast(Size as sql_variant)
when 'Created DESC' then cast(Created as sql_variant)
END desc
Ext.data.WsJsonStore = Ext.extend(Ext.data.JsonStore, {
constructor: function(c) {
var d = {
root: 'd',
proxy: new Ext.data.WsProxy({
url: c.url
})
}
Ext.data.WsJsonStore.superclass.constructor
.call(this, Ext.apply(d, c));
}
});
var store = new Ext.data.WsJsonStore({
url:'url',
fields: [fields],
...
});
Ext.data.WsProxy = Ext.extend(Ext.data.HttpProxy, {
constructor: function(c) {
var d = {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=utf-8'
}
}
Ext.data.WsProxy.superclass.constructor
.call(this, Ext.apply(d, c));
}
});
var proxy = new Ext.data.WsProxy({
url:'url'
});