我对Ransack有一个非常奇怪的问题,我很难确定。我在React docs中有一个表,该表显示了可供管理员搜索的产品列表。该产品清单可以按几个列名(即<div>
,// Assume driver is a valid WebDriver instance
WebElement parent = driver.findElement(By.cssSelector("div.bar");
// Since WebElement also extends SearchContext,
// we can do this, which limits the scope of the
// find to only children of the parent element
WebElement child = parent.findElement(By.cssSelector("div.foo");
和sku
)进行排序。但是,当我尝试按name
列进行排序时,该列表在列表的最后〜30个项目中出现了乱序(总共列出了3,000种产品)。似乎在某一点之后(几乎在结尾处)停止对price
名称进行排序。仅当我按sku
列而不是sku
或sku
排序时才会发生这种情况。
这是我用于这些列的代码:
name
我真的不知道price
列会导致在结束这一点之后排序变得不正确。 <thead>
<tr data-hook="admin_products_index_headers">
<th><%= sort_link @search, :sku, Spree::Product.human_attribute_name(:sku), { default_order: "desc" }, {title: 'admin_products_listing_sku_title'} %></th>
<th></th>
<th><%= sort_link @search, :name, Spree::Product.human_attribute_name(:name), { default_order: "desc" }, {title: 'admin_products_listing_name_title'} %></th>
<th class="align-right"><%= sort_link @search,:master_default_price_amount, Spree::Product.human_attribute_name(:price), {}, {title: 'admin_products_listing_price_title'} %></th>
<th data-hook="admin_products_index_header_actions" class="actions"></th>
</tr>
</thead>
字符串如下所示:sku
。它们全部以字母sku
开头,然后是标识产品的唯一整数。据我所知,这应该完全是Ransack的AB123456
可以毫无困难地处理的。但是a,我在这里挠头...