سبد (0)

آموزش ساخت TabStrip

آموزش ساخت Tab در Kendo UI


متد ()kendoTabStrip

با استفاده از متد ()kendoTabStrip در Kendo UI، می توانید یک TabStrip بسازید.

پیکربندی (Configuration)

نامتوضیحات
animation با استفاده از این خصوصیت می توانید، نحوه ی باز و بسته شدن گزینه های TabStrip را تغییر دهید. اگر آنرا با مقدار false تنظیم کنید، متحرک سازی لغو خواهد شد.
collapsible (default: false) قابلیت بسته شدن TabStrip بصورت کامل را تعیین می کند.
dataContentField (default: "") باید با نام فیلدی که برای محتوای Tabها در datasource در نظر گرفته ایم، تنظیم شود.
dataContentUrlField (default: "") اگر می خواهید محتوای Tabها از طریق یک آدرس URL خارجی پر شود، این پارامتر می تواند با نام فیلدی که در datasource در نظر گرفته اید، تنظیم شود.
dataImageUrlField (default: null) آدرس URL عکس را برای Tabها تعیین می کند. این پارامتر می تواند با نام فیلدی که در datasource در نظر گرفته اید، تنظیم شود.
dataSpriteCssClass (default: "") یک کلاس CSS برای Tabها تنظیم می کند. این پارامتر می تواند با نام فیلدی که در datasource در نظر گرفته اید، تنظیم شود.
dataSource با استفاده از این پارامتر می توانید منبع داده های TabStrip مشخص نمایید.
dataSpriteCssClassField (default: null) یک کلاس CSS برای نودها تعیین می کند.
dataTextField (default: "") باید با نام فیلدی که برای متن روی Tabها در dataSource درنظر گرفته ایم، تنظیم شود. (text)
dataUrlField (default: null) برای متن روی Tabها یک URL تنظیم می کند. این پارامتر می تواند با نام فیلدی که در datasource در نظر گرفته اید، تنظیم شود.

در مثال زیر، نحوه ساخت TabStrip با استفاده از متد ()kendoTabStrip و تنظیم پارامترهای مختلف آن نشان داده شده است:

مثال (RTL)

<!DOCTYPE html>
<html>
<head>
<title>RTL support</title>
<meta charset="utf-8">
<link href="/../../content/shared/styles/examples-offline.css" rel="stylesheet">
<link href="/../../../styles/kendo.common.min.css" rel="stylesheet">
<link href="/../../../styles/kendo.rtl.min.css" rel="stylesheet">
<link href="/../../../styles/kendo.default.min.css" rel="stylesheet">

<script src="/../../../js/jquery.min.js"></script>
<script src="/../../../js/kendo.web.min.js"></script>
<script src="/../../content/shared/js/console.js"></script>
<script>

</script>


</head>
<body>
<div id="example" class="k-content">

<div class="k-rtl">

<div class="demo-section">

<h3>TabStrip with images</h3>

<div id="tabstrip-images"></div>
</div>

<script>
$("#tabstrip-images").kendoTabStrip({
animation: { open: { effects: "fadeIn"} },
dataTextField: "text",
dataImageUrlField: "imageUrl",
dataContentField: "content",
dataSource: [
{
text: "Baseball",
imageUrl: "../../content/shared/icons/sports/baseball.png",
content: "Baseball is a bat-and-ball sport played between two teams of nine players each. The aim is to score runs by hitting a thrown ball with a bat and touching a series of four bases arranged at the corners of a ninety-foot diamond. Players on the batting team take turns hitting against the pitcher of the fielding team, which tries to stop them from scoring runs by getting hitters out in any of several ways. A player on the batting team can stop at any of the bases and later advance via a teammate's hit or other means. The teams switch between batting and fielding whenever the fielding team records three outs. One turn at bat for each team constitutes an inning and nine innings make up a professional game. The team with the most runs at the end of the game wins."
},
{
text: "Golf",
imageUrl: "../../content/shared/icons/sports/golf.png",
content: "Golf is a precision club and ball sport, in which competing players (or golfers) use many types of clubs to hit balls into a series of holes on a golf course using the fewest number of strokes. It is one of the few ball games that does not require a standardized playing area. Instead, the game is played on golf courses, each of which features a unique design, although courses typically consist of either nine or 18 holes. Golf is defined, in the rules of golf, as playing a ball with a club from the teeing ground into the hole by a stroke or successive strokes in accordance with the Rules."
},
{
text: "Swimming",
imageUrl: "../../content/shared/icons/sports/swimming.png",
content: "Swimming has been recorded since prehistoric times; the earliest recording of swimming dates back to Stone Age paintings from around 7,000 years ago. Written references date from 2000 BC. Some of the earliest references to swimming include the Gilgamesh, the Iliad, the Odyssey, the Bible, Beowulf, and other sagas. In 1578, Nikolaus Wynmann, a German professor of languages, wrote the first swimming book, The Swimmer or A Dialogue on the Art of Swimming (Der Schwimmer oder ein Zwiegespr?ch über die Schwimmkunst). Competitive swimming in Europe started around 1800, mostly using breaststroke."
},
{
text: "Snowboarding",
imageUrl: "../../content/shared/icons/sports/snowboarding.png",
content: "Snowboarding is a sport that involves descending a slope that is covered with snow on a snowboard attached to a rider's feet using a special boot set onto a mounted binding. The development of snowboarding was inspired by skateboarding, sledding, surfing and skiing. It was developed in the U.S.A. in the 1960s to 1970s and became a Winter Olympic Sport in 1998."
}
]

}).data("kendoTabStrip").select(0);
</script>

<div class="demo-section">

<h3>TabStrip with sprites</h3>

<div id="tabstrip-sprites"></div>
</div>

<script>
$("#tabstrip-sprites").kendoTabStrip({
animation: { open: { effects: "fadeIn"} },
dataTextField: "text",
dataSpriteCssClass: "spriteCssClass",
dataContentField: "content",
dataSource: [{
text: "Brazil",
spriteCssClass: "brazilFlag",
content: "Brazil, officially the Federative Republic of Brazil, is the largest country in South America. It is the world's fifth largest country, both by geographical area and by population with over 192 million people. It is the only Portuguese-speaking country in the Americas and the largest lusophone country in the world."
},
{
text: "India",
spriteCssClass: "indiaFlag",
content: "India, officially the Republic of India, is a country in South Asia. It is the seventh-largest country by geographical area, the second-most populous country with over 1.2 billion people, and the most populous democracy in the world. Bounded by the Indian Ocean on the south, the Arabian Sea on the south-west, and the Bay of Bengal on the south-east, it shares land borders with Pakistan to the west; China, Nepal, and Bhutan to the north-east; and Burma and Bangladesh to the east. In the Indian Ocean, India is in the vicinity of Sri Lanka and the Maldives; in addition, India's Andaman and Nicobar Islands share a maritime border with Thailand and Indonesia."
},
{
text: "Netherlands",
spriteCssClass: "netherlandsFlag",
content: "The Netherlands is a constituent country of the Kingdom of the Netherlands, located mainly in North-West Europe and with several islands in the Caribbean. Mainland Netherlands borders the North Sea to the north and west, Belgium to the south, and Germany to the east, and shares maritime borders with Belgium, Germany and the United Kingdom. It is a parliamentary democracy organised as a unitary state. The country capital is Amsterdam and the seat of government is The Hague. The Netherlands in its entirety is often referred to as Holland, although North and South Holland are actually only two of its twelve provinces."

}]
}).data("kendoTabStrip").select(0);
</script>

</div>
</div>
</body>
</html>
اجرای مثال »

رویدادهای TabStrip در Kendo UI

نامتوضیحات
activate بعد از اینکه یک Tab قابل رویت شد، اتفاق می افتد، اما قبل از اینکه متحرک سازی به اتمام برسد.
contentLoad زمانی که محتوای یک Tab از طریق یک درخواست آجاکسی واکشی شد، اتفاق می افتد.
error زمانی که نتیجه یک درخواست آجاکسی با error مواجه شود، اتفاق می افتد.
select چند لحظه قبل از اینکه یک Tab انتخاب شود، اتفاق می افتد.

در مثال زیر، هر تغییری که در TabStrip صورت گیرد، یک پیغام چاپ می شود:

مثال (Event)

<div id="example" class="k-content">
<div id="tabstrip">
<ul>
<li class="k-state-active">
First Tab
</li>
<li>
Second Tab
</li>
<li>
Third Tab
</li>
<li>
Fourth Tab
</li>
<li>
Fifth Tab
</li>
<li>
Ajax Tab
</li>
<li>
Error Tab
</li>
</ul>
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer felis libero, lobortis ac rutrum quis, varius a velit. Donec lacus erat, cursus sed porta quis, adipiscing et ligula. Duis volutpat, sem pharetra accumsan pharetra, mi ligula cursus felis, ac aliquet leo diam eget risus. Integer facilisis, justo cursus venenatis vehicula, massa nisl tempor sem, in ullamcorper neque mauris in orci. Proin sagittis elementum odio, eu vestibulum arcu rhoncus eu. Pellentesque lorem arcu, tempus at dapibus nec, tincidunt a ante. Cras eget arcu id augue sollicitudin fermentum. Quisque ullamcorper ultrices ante, ut mollis neque tincidunt nec. Aenean sollicitudin lobortis nibh, vitae sagittis justo placerat et. Fusce laoreet consequat arcu, quis placerat massa lacinia vel. Etiam fringilla purus ac ipsum euismod nec aliquet lorem aliquet. Aliquam a nunc ac lorem lobortis pulvinar. Integer eleifend lobortis risus vel commodo. Integer nisl turpis, facilisis a porttitor nec, tempus ac enim. Proin pulvinar vestibulum ligula id mattis. Integer posuere faucibus accumsan.</p>
</div>
<div>
<p>Ut orci ligula, varius ac consequat in, rhoncus in dolor. Mauris pulvinar molestie accumsan. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean velit ligula, pharetra quis aliquam sed, scelerisque sed sapien. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aliquam dui mi, vulputate vitae pulvinar ac, condimentum sed eros. Donec varius tristique erat in consequat. Pellentesque a blandit nulla. Aenean mattis eros vel magna laoreet ut rutrum turpis ultrices. Sed feugiat, urna id vulputate vulputate, dui nibh fringilla erat, at molestie diam arcu sed velit. Sed imperdiet suscipit dolor, sollicitudin feugiat orci ullamcorper cursus. Nunc non nunc arcu, et malesuada urna. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nullam tempor urna sed sapien aliquam ultricies. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>
</div>
<div>
<p>Aliquam at nisl quis est adipiscing bibendum. Nam malesuada eros facilisis arcu vulputate at aliquam nunc tempor. In commodo scelerisque enim, eget sodales lorem condimentum rutrum. Phasellus sem metus, ultricies at commodo in, tristique non est. Morbi vel mauris eget mauris commodo elementum. Nam eget libero lacus, ut sollicitudin ante. Nam odio quam, suscipit a fringilla eget, dignissim nec arcu. Donec tristique arcu ut sapien elementum pellentesque. Donec varius arcu in dolor elementum dignissim. Etiam ac consequat metus. Praesent semper diam id mi dictum sagittis. Etiam nulla metus, convallis sit amet rutrum non, cursus ornare ligula. Integer turpis leo, vulputate eget pulvinar in, condimentum sit amet metus. Pellentesque vulputate, velit non feugiat tincidunt, nulla dolor rutrum nibh, id gravida orci sem id nulla. Suspendisse egestas eleifend lorem vel lobortis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec odio elit, vestibulum ut placerat vitae, volutpat vitae erat. Aliquam sodales nisl in est varius at feugiat nibh sagittis. Cras et molestie erat. Integer elit lorem, mattis non tempus in, molestie vitae sapien.</p>
</div>
<div>
<p>Maecenas vitae eros vel enim molestie cursus. Proin ut lacinia ipsum. Nam at elit arcu, at porttitor ipsum. Praesent id viverra lorem. Nam lacinia elementum fermentum. Nulla facilisi. Nulla bibendum erat sed sem interdum suscipit. Vestibulum eget molestie leo. Aliquam erat volutpat. Ut sed nulla libero. Suspendisse id euismod quam. Aliquam interdum turpis vitae purus consectetur in pulvinar libero accumsan. In id augue dui, ac volutpat ante. Suspendisse purus est, ullamcorper id bibendum sed, placerat id leo. Cras ipsum augue, adipiscing ac fringilla ac, posuere tempor purus. Ut at rhoncus ipsum. Sed sodales aliquam dolor, non dictum ipsum facilisis at. Integer non orci arcu, auctor aliquam purus.</p>
</div>
<div>
<p>Fusce nec mauris enim, non pharetra neque. Etiam elementum nunc ut velit fermentum sed porta eros dignissim. Duis at nisl eros. Integer arcu nisl, accumsan non molestie at, elementum nec odio. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque arcu odio, aliquam vel viverra ac, varius at sapien. Nullam elementum nulla non libero interdum vestibulum at in lacus. Curabitur ac magna ac lacus dapibus convallis non at turpis. Curabitur risus diam, adipiscing vel bibendum non, luctus ut lectus. Donec erat felis, volutpat quis tincidunt eget, condimentum at enim. Cras condimentum, elit vitae facilisis fermentum, quam justo pulvinar lacus, in semper nunc lorem vel risus. Nunc quis mauris orci. Sed ultricies sagittis aliquam. Curabitur nec faucibus nisl. Maecenas vel mauris tellus. Nulla facilisi. Quisque pulvinar, nunc sed ultricies condimentum, dui nisl facilisis augue, id laoreet felis neque id dolor.</p>
</div>
<div></div>
<div></div>
</div>
</div>
<script>
$(document).ready(function() {
function onSelect(e) {
kendoConsole.log("Selected: " + $(e.item).find("> .k-link").text());
}

function onActivate(e) {
kendoConsole.log("Activated: " + $(e.item).find("> .k-link").text());
}

function onContentLoad(e) {
kendoConsole.log("Content loaded in <b>"+ $(e.item).find("> .k-link").text() + "</b> and starts with <b>" + $(e.contentElement).text().substr(0, 20) + "...</b>");
}

function onError(e) {
kendoConsole.error("Loading failed with " + e.xhr.statusText + " " + e.xhr.status);
}

$("#tabstrip").kendoTabStrip({
select: onSelect,
activate: onActivate,
contentLoad: onContentLoad,
error: onError,
contentUrls: [ , , , , , "../../content/web/tabstrip/ajax/ajaxContent1.html", "error.html" ]
});
});
</script>
<div class="console"></div>
اجرای مثال »
تمامی محصولات و خدمات این وبسایت، حسب مورد دارای مجوزهای لازم از مراجع مربوطه می‌باشند و فعالیت‌های این سایت تابع قوانین و مقررات جمهوری اسلامی ایران است.
logo-samandehi مجوز نشر دیجیتال از وزرات فرهنگ و ارشاد اسلامی پرداخت آنلاین -  بانک ملت معرفی بیاموز در شبکه سه