Forum

jqgrid 5 - select2 ...
 
Notifications
Clear all

jqgrid 5 - select2 init

1 Posty
1 Users
0 Reactions
1,508 Widok
0
Topic starter

example

1 Answer
0
Topic starter

1. script

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 $("#jqGrid").jqGrid({
        url: 'user/list_ajax',
        datatype: "json",
        colModel: [
            {
                name: 'user_roles', width: 105, align: 'center', editable: true, formatter: 'select',
                edittype: 'select', editoptions:
                    {
                        dataUrl: "user/select2_roles",
                        multiple: true,
                        defaultValue: 'IN',
                        dataInit: function (elem) {
                            $(elem).select2({
                                placeholder: "my text for select2",
                                allowClear: true,
                                language: "ru"
                            });
                        }
                    }
            },
        ],
        ...
 $("#jqGrid").jqGrid({
		url: 'user/list_ajax',
		datatype: "json",
		colModel: [
			{
				name: 'user_roles', width: 105, align: 'center', editable: true, formatter: 'select',
				edittype: 'select', editoptions:
					{
						dataUrl: "user/select2_roles",
						multiple: true,
						defaultValue: 'IN',
						dataInit: function (elem) {
							$(elem).select2({
								placeholder: "my text for select2",
								allowClear: true,
								language: "ru"
							});
						}
					}
			},
		],
		...

2. prepare dataUrl: ”user/select2_roles”, this page must generate select html code, example:

1
2
3
4

    Alabama
    Wyoming
    Afdsf
    4fdsf

    Alabama
    Wyoming
    Afdsf
    4fdsf

3. not perfect

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: