JqG​​rid - 如果前5个字符相等,则按列Onluy分组

时间:2015-05-13 11:12:36

标签: jqgrid

Hello stackoverflow用户,

我有一个已按列分组的表格,此列的格式如下: 01100000-8

我想要做的是分组,如果前5位数相等而不是所有字符串,例如:

01100 000-8 - GROUPED 1

01100 303-4 - GROUPED 1

01100 003-9 - GROUPED 1

11203 453-2 - 分组 2

11203 657-1 - 分组 2

任何人都知道如何实现这一目标?

提前致谢。

此致 马塞洛

1 个答案:

答案 0 :(得分:1)

您不是第一个遇到问题的人。在回答the question时,我想到了如何修改jqGrid的代码并引入<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/bg1" tools:context="com.lanceit.haito.lanceit.activities.HubActivity"> <android.support.v4.view.PagerTitleStrip android:id="@+id/pager_strip" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/primary_material_dark" android:paddingBottom="10dp" android:paddingTop="10dp" /> </android.support.v4.view.ViewPager> <!-- The navigation drawer --> <RelativeLayout android:layout_width="280dp" android:layout_height="match_parent" android:id="@+id/drawerPane" android:layout_gravity="start"> <!-- Profile Box --> <RelativeLayout android:id="@+id/profileBox" android:layout_width="match_parent" android:layout_height="100dp" android:background="@color/material_blue_grey_800" android:padding="8dp" > <ImageView android:id="@+id/avatar" android:layout_width="50dp" android:layout_height="50dp" android:src="@drawable/ic_launcher" android:layout_marginTop="15dp" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="42dp" android:layout_centerVertical="true" android:layout_marginLeft="15dp" android:layout_toRightOf="@+id/avatar" android:orientation="vertical" > <TextView android:id="@+id/userName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Rishabh" android:textColor="#fff" android:textSize="16sp" android:textStyle="bold" /> <TextView android:id="@+id/desc" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom" android:layout_marginTop="4dp" android:text="View Profile" android:textColor="#fff" android:textSize="12sp" /> </LinearLayout> </RelativeLayout> <!-- List of Actions (pages) --> <ListView android:id="@+id/list_slidermenu" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:color/holo_red_light" android:choiceMode="singleChoice" android:divider="@android:color/black" android:dividerHeight="5dp"/> </RelativeLayout> </android.support.v4.widget.DrawerLayout> 回调函数,该函数可用于指定哪些项应被解释为相同。例如,最常见的情况是忽略时间并仅使用日期时间对列进行分组。

如果使用此类isInTheSameGroup回调,请务必使用另一个回调isInTheSameGroup来显示如何显示分组标题。很明显,如果您将formatDisplayField01100000-801100303-4放在同一组中,那么显示01100003-9作为分组标题将不会很好。因此,应该使用回调01100000-8将显示的字段切割为用于分组的前5个数字:formatDisplayField

我没有测试过,但我认为你应该使用类似下面的内容

01100