четвер, 30 червня 2011 р.

Oracle RETURNING Clause - get identity of inserted row


PROCEDURE Ins
(pContactID OUT Contacts.ContactID%TYPE,
pFirstname IN Contacts.Firstname%TYPE,
pSurname IN Contacts.Surname%TYPE)
IS
BEGIN
INSERT INTO Contacts
(fname, sname)
VALUES
(pFirstname, pSurname)
RETURNING ContactID INTO pContactID;
END;

ExtJS 4.0 GridPanel double-click event

In ExtJS 4.0 you need to listen for events on the GridPanel’s view, via the “viewConfig”:

viewConfig: {
listeners: {
itemdblclick: function(dataview, index, item, e) {
console.log('itemdblclick');
}
}
}

середу, 22 червня 2011 р.

вівторок, 21 червня 2011 р.

ExtJS State

Set provider:

Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
expires: new Date(new Date().getTime() + (1000 * 60 * 60 * 24 * 30))//30 days
}));


Field Example:

{
xtype: 'textfield',
fieldLabel: 'Логин',
name: 'UserName',
allowBlank: false,
validateOnBlur: false,
blankText: 'Введите логин',
stateful: true,
stateId: 'UserName',
stateEvents: ['blur'],
getState: function () {
return { value: this.getValue() };
},
applyState: function (state) {
this.setValue(state.value);
}
}

ExtJS получить параметры URL

Add ext-methods:

Ext.apply(Ext, {
urlParams: function () {
return Ext.Object.fromQueryString(location.search);
},
urlParam: function (name) {
return this.urlParams()[name];
}
});

Use:

var query = Ext.urlParams();
var p1 = query.p1;
//or
var p2 = Ext.urlParam('p2');

пʼятницю, 17 червня 2011 р.

ORA-01008: not all variables bound

Если код 100 раз проверен, а ошибка есть - лечит ошибку:

command.BindByName = true;

середу, 15 червня 2011 р.

ExtJS: 3 Value Checkbox

js:

{
xtype: 'checkbox',
fieldLabel: 'Active',
name: 'Active',
inputValue: 'true',
cls: 'value-undefined',
handler: function () {
if (!this.uncheckedValue) {
this.removeCls('value-undefined');
this.uncheckedValue = 'false';
}
},
reset: function () {
this.setValue(undefined);
this.addCls('value-undefined');
if (this.uncheckedValue) this.uncheckedValue = undefined;
}
}

css:

.x-field.value-undefined input
{
opacity:0.4;
}

четвер, 9 червня 2011 р.

Ext JS 4: localize grid loading message


Ext.view.AbstractView.prototype.loadingText = "Загрузка...";

MVC 3 Content with no cache

Simple helper:

public static class UrlHelperExtensions
{
public static string ContentNoCache(this UrlHelper url, string path)
{
return url.Content("{0}?_dc={1}".FormatWith(path, DateTime.Now.ToFileTime()));
}
}

where FormatWith:

public static string FormatWith(this string input, params object[] args)
{
return string.Format(input, args);
}

Use:
<script src="@Url.ContentNoCache("~/Scripts/app.js")" type="text/javascript"></script>
Result:
<script src="/Scripts/app.js?_dc=129520920501677826" type="text/javascript"></script>

пʼятницю, 3 червня 2011 р.

Sql paging in Oracle


select t.*
from (select t.*, row_number() over (order by t.aps_id desc) rn
from pds_sales.tbl_all_pds_sales t) t
where t.rn > :first and t.rn <= :last

четвер, 2 червня 2011 р.

ExtJs 4 dateFormat M$

ExtJS 3:
{ name: 'SaleDate', type: 'date', dateFormat: "M$" }


ExtJS 4:
{ name: 'SaleDate', type: 'date', dateFormat: "MS" }