0

I'm building a web application where I have categories and subcategories. Since I have right now 1900 rows in a table and it's growing up I need a component to show them as follow:

  1. A first level should show main categories (those who have not parents)
  2. When I pick any of the parents categories then inside the same component I should able to show their children and also give the ability to go back and pick any other category.

Does any one know any kind of component to do this? Maybe a SELECT or something else? Also if any have ideas programmatic then leave here and I'll take into account.

PS: I don't know if this is the right place to post this if not apologies and point me in the right direction for the next one.

4

1 回答 1

1

如果您的目标是愚弄用户并让他认为这是同一个组件,那么您可能会做类似的事情

您必须从服务器获取所选类别的匹配数据,可能带有 ajax 请求和 json 对象,以便填充选择。

$.ajax({
  ....
  success:function(data){
     $('#item').empty();
     $(data).each(function(){
        $('#item').append($('<option>').val(this.value).text(this.description));
     }
  }
});

但我仍然认为双选对用户来说更方便。但是,如果您的目标是只显示数据,那么在选择组件中显示项目是个坏主意。表格或列表会更合适。

于 2013-09-05T14:28:31.037 回答