设置blueprintjs中元素的数量建议元素

时间:2018-03-14 08:17:48

标签: reactjs typescript blueprintjs

我正在使用blueprintjs可视化工具包处理react应用程序。但问题是,与文档中显示的示例不同,我的<Suggest>框将显示数组中的所有元素,而不是前10个。我当前的代码:

                        <Suggest
                        items={this.props.documentTypes}
                        itemRenderer={(items, meta) => {
                            if (meta.modifiers.matchesPredicate) {
                                return (
                                    <MenuItem
                                        label={items[1]}
                                        key={items[0]}
                                        text={items[1]}
                                        onClick={meta.handleClick}
                                    />
                                );
                            } else {
                                return null;
                            }
                        }}
                        itemPredicate={(query, item) => {
                            let result =
                                `${item[0].toLowerCase()} ${item[1].toLowerCase()}`.indexOf(
                                    query.toLowerCase()
                                ) >= 0;
                            return result;
                        }}
                        inputValueRenderer={item => item[1]}
                        noResults={
                            <MenuItem
                                disabled={true}
                                text="No document types found."
                            />
                        }
                        onItemSelect={this.changeDocType}
                        popoverProps={{ popoverClassName: Classes.MINIMAL }}
                    />

有没有办法指定显示多少元素?我无法在文档中找到此设置。

1 个答案:

答案 0 :(得分:1)

我认为您可以使用import snowflake.connector as scon from flask import Flask from flask_socketio import SocketIO import eventlet eventlet.monkey_patch() def query(): # Gets the version ctx = scon.connect( user='xxx', password='xxxxxxxx', account='xxxxxx', ) cs = ctx.cursor() try: cs.execute("SELECT current_version()") one = cs.fetchone() return 'Snowflake version={}'.format(one[0]) finally: cs.close() app = Flask(__name__) socketio = SocketIO(app) @app.route('/') def query_route(): return query() socketio.run(app,debug=False, host='localhost', port=5000) 代替Traceback (most recent call last): File "/home/chad/miniconda2/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/home/chad/miniconda2/lib/python2.7/threading.py", line 754, in run self.__target(*self.__args, **self.__kwargs) File "/home/chad/miniconda2/lib/python2.7/multiprocessing/pool.py", line 327, in _handle_workers while thread._state == RUN or (pool._cache and thread._state != TERMINATE): AttributeError: '_MainThread' object has no attribute '_state' Exception in thread Thread-6: Traceback (most recent call last): File "/home/chad/miniconda2/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/home/chad/miniconda2/lib/python2.7/threading.py", line 754, in run self.__target(*self.__args, **self.__kwargs) File "/home/chad/miniconda2/lib/python2.7/multiprocessing/pool.py", line 363, in _handle_tasks cache[job]._set(ind + 1, (False, ex)) TypeError: unsupported operand type(s) for +: 'NoneType' and 'int' 。然后使用itemListPredicateitemPredicate。像这样......

.filter()