PDA

View Full Version : فیلتر در جانوس



sahra_777
سه شنبه 22 فروردین 1385, 12:42 عصر
با سلام ...من فیلتر در janusGrid رو میخوام کسی میتونه کمک کنه؟؟؟؟

hadi2345
سه شنبه 22 فروردین 1385, 15:24 عصر
با سلام.
از Help جانوس برای حل مشکلاتتون استفاده کنید . و اگه باز هم حل نشد میتونید از سایت جانوس استفاده کنید که سوال رو مطرح میکنید و سریعا پاسخ داده میشه !! .

www.janusys.com

من مطلبی رو از Help جانوس براتون میذارم ، امیدوارم که مشکلتون حل بشه . من از همین روش استفاده میکنم و تا حالا مشکلی هم پیش نیومده . در ضمن اگر مشکلتون حل نشد ، بگید تا نمونه برنامه براتون بذارم .



1) Create a new "Windows Application" Project.



2) In the Servers window, open the JSNorthWind.mdb data connection that was created in Tutorial 1.



3) Drag OrderDetailsExtended from the View node drop it into Form1.



4) Rename the components created as follows:


oleDBConnection1 changes to NWindConnection

oleDBDataAdapter1 changes to daOrderDetails


5) Select Form1 and in the Properties Window click in the "Generate Dataset..." link.



6) In the Generate Dataset dialog, change the proposed name to NorthWind.



7) Change the NorthWind1 component name that was create in Form1 to dsNorthWind



8) Drag a GridEX control from the toolbox into the Form designer.



Select GridEX control in the Form and set the following properties in the properties window:

DataSource = dsNorthWind
DataMember = "OrderDetailsExtended"



9) Right click in the GridEX control and select "Retrieve Structure" menu. This action will force the control to read the DataSource structure and create the columns needed to show all the fields in the table.



10) In the Load event of the Form fill the tables in the dataset with the following code:




daOrderDetails.Fill(dsNorthWind)




11) Add a button to filter records by a predetermined employee. In the tutorial, the code will filter the order details rows to show only the order details where Employee column is equal to 'Davolio, Nancy'.



The code to create such filter is as follows:


In VB .Net



Dim filter As GridEXFilterCondition

filter = New GridEXFilterCondition(GridEX1.RootTable.Columns("Employee"), _

ConditionOperator.Equal, "Davolio, Nancy")

GridEX1.RootTable.FilterCondition = filter


In C# .Net


GridEXFilterCondition filter;

filter = new GridEXFilterCondition(GridEX1.RootTable.Columns["Employee"], ConditionOperator.Equal,"Davolio, Nancy");

GridEX1.RootTable.FilterCondition = filter;


12) Add a button to filter records by a predetermined customer. In the tutorial, the code will filter the order details rows to show only the order details where Customer column is equal to 'Around The Horn'.



The code to create such filter is as follows:


In VB .Net



Dim filter As GridEXFilterCondition

filter = New GridEXFilterCondition(GridEX1.RootTable.Columns("Customer"), _

ConditionOperator.Equal, "Around The Horn")

GridEX1.RootTable.FilterCondition = filter


In C# .Net


GridEXFilterCondition filter;

filter = new GridEXFilterCondition(GridEX1.RootTable.Columns["Customer"],

ConditionOperator.Equal,"Around The Horn");

GridEX1.RootTable.FilterCondition = filter;


13) Add a button to filter records by a predetermined range of dates. In the tutorial, the code will filter the order details rows to show only the order details where OrderDate column is between 1/1/2001 and 12/31/2001.



The code to create such filter is as follows:


In VB .Net


Dim filter As GridEXFilterCondition

filter = New GridEXFilterCondition(GridEX1.RootTable.Columns("OrderDate"), _

ConditionOperator.Between, _

New DateTime(2001, 1, 1), New DateTime(2001, 12, 31))

GridEX1.RootTable.FilterCondition = filter


In C# .Net


GridEXFilterCondition filter;

filter = new GridEXFilterCondition(GridEX1.RootTable.Columns["OrderDate"],

ConditionOperator.Between,new DateTime(2001,1,1),new DateTime(2001,12,31));

GridEX1.RootTable.FilterCondition = filter;


14) Add a button to remove the filter applied to the GridEX control. The code to remove the filter in a GridEX control is as follows:


GridEX1.RemoveFilters()



15) In addition to the predetermined filters, you can easily create a form that allows the user to define its own filter. In the tutorial, we create a form with a combo that allows the user to select the column, another column to select the operator and a couple of text boxes where the user can type the value(s) of the condition. Then, when the user presses Ok button the filter condition is created as follows:


In VB .Net:


'getting the column selected by the user

Dim column As GridEXColumn = CType(cboColumn.SelectedItem, GridEXColumn)

'getting the condition operator selected by the user

Dim conditionOp As ConditionOperator

conditionOp = CType(cboOperator.SelectedItem, ConditionOperator)


Dim filter As GridEXFilterCondition

'in cases where the type of the data is not string,

'it is necessary to parse the text entered by the user

'to convert it to the same type of the data.

Dim value1 As Object = ParseText(txtValue.Text, column)

Dim value2 As Object = Nothing

If txtValue2.Enabled Then

value2 = ParseText(txtValue2.Text, column)

End If

'create the filter

filter = New GridEXFilterCondition(column, conditionOp, value1, value2)

'apply the filter

table.FilterCondition = filter



In C# .Net


//getting the column selected by the user

GridEXColumn column = (GridEXColumn)cboColumn.SelectedItem;

//getting the condition operator

ConditionOperator conditionOp = (ConditionOperator)cboOperator.SelectedItem;

GridEXFilterCondition filter;

//in cases where the type of the data is not string,

//it is necessary to parse the text entered by the user

//to convert it to the same type of the data.

object value1 = ParseText(txtValue.Text, column);

object value2 = null;

if(txtValue2.Enabled)

{

value2 = ParseText(txtValue2.Text, column);

}

//create the filter

filter = new GridEXFilterCondition(column, conditionOp, value1, value2);

//apply the filter

table.FilterCondition = filter;


موفق باشید .

ali_kolahdoozan
سه شنبه 22 فروردین 1385, 17:52 عصر
ببین اگه من درست حالیم شده باشه خوب یک sqlcommand و همون qurey نتیجه رو درست درون janus grid نشون می ده حالا دیگه نمی دونم منظورت رو درست فهمیدم یا نه

gridEX1.DataSource = yourdataset;
gridEX1.DataMember = yourtablename";
gridEX1.RetrieveStructure()

Hamedm
سه شنبه 22 فروردین 1385, 17:59 عصر
سلام

با سلام ...من فیلتر در janusGrid رو میخوام کسی میتونه کمک کنه؟؟؟؟گرید جانوس چند نوع فیلتر داره. شما منظورتون کدومشونه؟

در پناه حق موفق باشید و پرتوان

sahra_777
شنبه 26 فروردین 1385, 05:50 صبح
ببینید من در کوئری نوشتن مشکلی ندارم من میخوام مثل یکی از sampel های جانوس که یه سطر بالا ایجاد میکنه من با پر کردن هر فیلد نتیجه رو در گرید نمایش میده اگه میشه در این مورد راهنمایی کنید

Hamedm
شنبه 26 فروردین 1385, 09:06 صبح
سلام

ببینید من در کوئری نوشتن مشکلی ندارم من میخوام مثل یکی از sampel های جانوس که یه سطر بالا ایجاد میکنه من با پر کردن هر فیلد نتیجه رو در گرید نمایش میده اگه میشه در این مورد راهنمایی کنیدمتوجه شدم شما منظورتون چیه.
جانوس برای این کار یک Tutorial داره که اگه بهش نگاهی بندازید همه چیز دستتون میاد.

در پناه حق موفق باشید و پرتوان

ali_kolahdoozan
شنبه 26 فروردین 1385, 09:09 صبح
میشه اصلا منظور ایشون رو برای من توضیح بدید من یه کم نوفهمم

sahra_777
شنبه 26 فروردین 1385, 09:16 صبح
سلام ...پس لطف کنید شماره taturial رو بگید چون اگه پیدا کرده بودم که نمی پرسیدم

Hamedm
شنبه 26 فروردین 1385, 09:39 صبح
سلام
سلام ...پس لطف کنید شماره taturial رو بگید چون اگه پیدا کرده بودم که نمی پرسیدمشماره 17.

در پناه حق موفق باشید و پرتوان

sahra_777
شنبه 26 فروردین 1385, 10:31 صبح
مثل اینکه شما منظور من رو متوجه نشدین مثال 17 اصلا همچین چیزی نیست شما از demo ها gridex و filter row را ببینید من همچین چیزی میخوام . demo>gridex sampels>filter row

ali_kolahdoozan
شنبه 26 فروردین 1385, 12:49 عصر
بابا منو حالیم کنید چی می خواهید جوابتون با من

Hamedm
شنبه 26 فروردین 1385, 13:11 عصر
سلام
quote=sahra_777]مثل اینکه شما منظور من رو متوجه نشدین مثال 17 اصلا همچین چیزی نیست شما از demo ها gridex و filter row را ببینید من همچین چیزی میخوام . demo>gridex sampels>filter row[/quote]آهان. حالا فهمیدم.
روش کار میکنم و خبرشو بهتون میدم.

در پناه حق موفق باشید و پرتوان

sahra_777
شنبه 26 فروردین 1385, 13:59 عصر
مرسی ...منتظرم

hadi2345
یک شنبه 27 فروردین 1385, 20:18 عصر
با سلام مجدد و با اجازه از حامد عزیز ،

در GridExTutorial 20 ، در خصوصیات گرید ، FilterMode را در Automatic قرار دهید . به این خاطر شماره 20 رو گفتم که از فیلترهای دیگه هم تو این مثال استفاده شده !! .

موفق باشید .

sahra_777
دوشنبه 28 فروردین 1385, 07:32 صبح
سلام ...FILTERMODE فقط یه سطر خالی ایجاد میکنه من میخوام با Change فیلدها دیتاگرید فیلتر بشه اگه کدی داره من اونو میخوام

sahra_777
دوشنبه 28 فروردین 1385, 12:46 عصر
چرا هیچکس جواب نمیدههههههههههههههههههههه ه

hadi2345
دوشنبه 28 فروردین 1385, 16:25 عصر
سلام ...FILTERMODE فقط یه سطر خالی ایجاد میکنه من میخوام با Change فیلدها دیتاگرید فیلتر بشه اگه کدی داره من اونو میخوام

اشتباه نکنید روشش همینه و یک خط کد هم نداره!! . من دیروز این کار رو کردم و جواب داد !! . دقیقا مثل Sample خود جانوس ! . فقط یک مشکل داشت و اونم این بود که باید مقدار رو وارد میکردید و با کلید Enter فیلتر انجام میشد ، در حالیکه تو Sample خودش به صورت Combo بود و با انتخاب یکی از آیتم ها فیلتر انجام میشد !! . برای این کار من هر کاری کردم تو Design نشد ولی در RunTime با یک خط کد مشکل حل میشه و گرید بصورت دلخواه در میاد :

YourGridName.FilterRow.Cells(0).Column.FilterEditT ype = Janus.Windows.FilterEditType.Column

سعی میکنم یک Sample براتون بذارم .

موفق باشید .

hadi2345
سه شنبه 29 فروردین 1385, 08:09 صبح
همون Tutorial20 هست که یه کم Update شده !!! .
موفق باشید .

sahra_777
سه شنبه 29 فروردین 1385, 10:51 صبح
خیلی خیلی ممنون از جوابتون دقیقا همینه فقط کدش باید این شکلی باشه
Grid.FilterRow.Cells(0).Column.FilterEditType = Janus.Windows.GridEX.FilterEditType.Combo

Hamedm
چهارشنبه 30 فروردین 1385, 17:55 عصر
سلام

همون Tutorial20 هست که یه کم Update شده !!! .
موفق باشید .
آقـــــــــــــــــــــــ ــــــــــــــــای خیلی پور این عکس Copy Right داره. از برنامه نویسش اجازه گرفتید؟ :لبخند:

در پناه حق موفق باشید و پرتوان

hadi2345
پنج شنبه 31 فروردین 1385, 09:32 صبح
سلام

آقـــــــــــــــــــــــ ــــــــــــــــای خیلی پور این عکس Copy Right داره. از برنامه نویسش اجازه گرفتید؟ :لبخند:

در پناه حق موفق باشید و پرتوان

خیلی پور چیه پسر !!!!!؟؟؟؟؟ . برنامه نویسش یه آش خوره که خودمم !!! .

حامد هر وقت Crack جانوس 2005 رو پیدا کردی ، ما رو هم بی نصیب نذار . ممنون .

موفق باشید .

shahabm58
چهارشنبه 20 اردیبهشت 1385, 14:40 عصر
چه طور میشه دمویی که موقع ران janus ظاهر میشه غیر فعال نمود.

shahabm58
چهارشنبه 20 اردیبهشت 1385, 14:42 عصر
مثل اینکه شما منظور من رو متوجه نشدین مثال 17 اصلا همچین چیزی نیست شما از demo ها gridex و filter row را ببینید من همچین چیزی میخوام . demo>gridex sampels>filter row

به چه شکل میشه دموی janus را غیر فعال نمود

hadi2345
شنبه 23 اردیبهشت 1385, 08:07 صبح
با سلام .

اگه منظورتون رو درست متوجه شده باشم ، دمویی که شما به اون اشاره کردید به خاطر تریال بودن جانوس ظاهر میشه و باید از ک . ر . ک . ش ! استفاده کنید !!! .

موفق باشید .

davoodrm666_666
دوشنبه 04 آذر 1387, 15:14 عصر
آقا یکی این جانوس رو به ما هم می ده

mahtab200711
دوشنبه 23 دی 1392, 15:36 عصر
خیلی خیلی ممنون از جوابتون دقیقا همینه فقط کدش باید این شکلی باشه
Grid.FilterRow.Cells(0).Column.FilterEditType = Janus.Windows.GridEX.FilterEditType.Combo


اره این روش خیلی خوبه
فقط من نمی دونم چطور به جای combo در این روش از checkedlistbox استفاده کنم
برای اینکه بتونم روی چند مورد فیلتر رو انجام بدم

arezoo jabbari
دوشنبه 26 آبان 1393, 14:03 عصر
بنظر من اول نوع
filterrow button style گرید رو از گزینه ی پروپرتیس به condition operator dropdown
تغییر بده بعد وارد دیزاین گرید بشو تو قسمت روت تیبل ستون مورد نظر
filter row comparison رو برابر با equal یا contain قرار بده
کد:
grid.FilterRowButtonStyle=ConditionOperatorDropDow n
grid.column["columnKey"].FilterRowComparison=Equal