    $('#modelMainItem_name').typeahead(
        {
            minLength: 0,
            highlight: true,
            source: function(request, response) {
                var formData = {
                    dept_uid: $('#dept_select').val()
                };

                $.ajax({
                    url: "/AuthApi/authMainItemList",
                    type: "post",
                    data: formData,
                    success: function(data, textStatus, jqXHR) {
                        if (data.ret == "yes") {
                            var obj = data.mainItems;

                            mainItem_items = [];
              function loadMainItemTypeahead() {
              mainItem_map = {};

                            $.each(obj, function(i, item) {
                                var id = item.mainItem_uid;
                                var name = item.mainItem_name;
                                mainItem_map[name] = { id: id, name: name };
                                mainItem_items.push(name);
                            });
                            response(mainItem_items);
                        } else {
                            alert(data.message);

                            if (data.err_code == "99999") {
                                location.href = "/Root/Login";
                            }
                        }
                    },
                    error: function(jqXHR, textStatus, errorThrown) {
                        alert('網路或伺服器發生錯誤，請稍後重試!');
                    }
                });


            },
            updater: function(item) {
                $('#parent_mainItem_uid').val(mainItem_map[item].id);
                return item;
            }
        }
    );
}
