无法从表单中隐藏kendo下拉列表

时间:2016-04-17 10:57:27

标签: jquery kendo-ui

我在表单中有很多kendo下拉列表,但我只想隐藏kendodropdownlist。 这是我隐藏的代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="#252525"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/toolbar"
        android:fillViewport="true">

        <RelativeLayout
            android:id="@+id/rel"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <ImageView
                android:id="@+id/poster"
                android:layout_width="96dp"
                android:layout_height="128dp"
                android:layout_alignParentRight="true"
                android:layout_margin="8dp"
                android:background="#eee"
                android:src="@mipmap/ic_launcher" />

            <TextView
                android:id="@+id/txt_onvan"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignTop="@id/poster"
                android:layout_marginBottom="8dp"
                android:layout_toLeftOf="@id/poster"
                android:text="عنوان" />

            <TextView
                android:id="@+id/txt_sazande"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/txt_onvan"
                android:layout_marginBottom="8dp"
                android:layout_toLeftOf="@id/poster"
                android:text="سازنده" />

            <TextView
                android:id="@+id/txt_nazar"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/txt_sazande"
                android:layout_toLeftOf="@id/poster"
                android:text="تعداد نظر" />

            <android.support.design.widget.TabLayout
                android:id="@+id/tablayout"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:layout_below="@id/poster" />

            <android.support.v4.view.ViewPager
                android:id="@+id/viewpager"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/tablayout"
                />

        </RelativeLayout>
    </ScrollView>
</RelativeLayout>

我在互联网上搜索,我找到了这个解决方案,它可以隐藏但是表单中的所有下拉列表都会消失。这是代码:

$("#minpass").css("display", "none");
$("#minpass").hide();

这是我的kendodropdownlist:

var minpassdropdownlist = $("#minpass").data("kendoDropDownList");
minpassdropdownlist.closest(".k-widget").hide();

请帮帮我,谢谢。

2 个答案:

答案 0 :(得分:6)

试试这个我认为这会有用

var dropdownlist = $("#dropDownList").data("kendoDropDownList");
dropdownlist.wrapper.hide(); // call for hide kendo dropdown call
 dropdownlist.wrapper.show();// to make it visible again

答案 1 :(得分:0)

我还没有看到任何可以隐藏它的kendo UI下拉列表方法。我发现destroy可以删除原始select元素周围的任何更改,然后你可以隐藏它,当你再次显示它时必须重做Kendo下拉列表。

.closest解决方案应该有效,从control's demo page来判断。原始输入元素隐藏在一系列跨度内,最上面的一个具有类k-widget k-dropdown k-header

相关问题