magento 2 - 如何在销售订单网格中显示日期时间过滤器?

时间:2017-12-27 15:47:30

标签: magento2 magento2.1

在magento 2销售订单网格默认日期购买过滤器有,但我想过滤日期和时间两者。请帮我怎么做。

我尝试过如下,但我没有得到任何解决方案。

由于

test -d [0-9][0-9]* ; echo $?

2 个答案:

答案 0 :(得分:0)

dateFormat项目中的问题。使用以下代码,这将适合您。

 Collection<MyDocumentSample spec = new Collection<MyDocumentSample()
 { 
  new MyIdSample() { SampleID = 1234 } };
  int index = 0;
  int maxNoOfRows = 2;
  MyDocumentListSortFields sortFeild = new
  MyDocumentListSortFields() 
  { 
       Descending = false, 
       SortField = MyDocumentListSortFields.SortFields.Date 
  };


var bundleOfObjects = new bundleOfObjects { Entry = new List<bundleOfObjects.EntryComponent() };

MySampleDocument resource_1 = new MySampleDocument();
resource_1.Id = "1005823";
resource_1.Description = "Test 1";
resource_1.Created = "11/20/2017 12:59:47 PM";


bundleOfObjects.AddTobundleOfObjects(resource_1, null);
var m_documentWrapperHelperMock = new Mock<IDocumentSampleHelper();
var m_configMock = new Mock<IConfiguration();

m_documentWrapperHelperMock.Setup(x => x.GetSampleDocumentsWithOffSets(spec, index, maxNoOfRows, sortFeild)).Returns(bundleOfObjects);


var service = new MySampleDocumentService(m_configMock.Object, m_documentWrapperHelperMock.Object);

答案 1 :(得分:0)

改用这个

<column name="created_at" class="Magento\Ui\Component\Listing\Columns\Date" component="Magento_Ui/js/grid/columns/date">
  <settings>
    <filter>dateRange</filter>
    <dataType>date</dataType>
    <label translate="true">Created</label>
  </settings>
</column>