Lib.AspNetCore.Mvc.JqGrid icon indicating copy to clipboard operation
Lib.AspNetCore.Mvc.JqGrid copied to clipboard

Add support for custom searching

Open tpeczek opened this issue 8 years ago • 2 comments

tpeczek avatar Apr 30 '17 17:04 tpeczek

Hi Sir,

How can make the Gender read from database which I have table to stored the Gender Id & Name? How to make the enum

public enum Genders
    {
        Female = 1,
        Male = 2,
        Hermaphrodite = 3
    }

to be read from dataContext instead hardcoded as above?

public Dictionary<string, string> GetGendersDictionary()
        {
            var list = _db.Gender.Select(t => new { t.Id, t.Name })
            .ToDictionary(t => t.Id.ToString(), t => t.Name.ToString());
            return list;
        }

[JqGridColumnSearchable(typeof(DictionariesViewModel), "GetGendersDictionary", SearchType = JqGridColumnSearchTypes.Select, SearchOperators = JqGridSearchOperators.EqualOrNotEqual | JqGridSearchOperators.NullOperators)]

Please advise.

Regards, Micheale

MichealeSee avatar May 02 '18 05:05 MichealeSee

@MichealeSee I'm not sure what is the actual issue you are having. My wild guess would be problem with injecting context into class providing dictionary, but I can't be sure without more details from you.

tpeczek avatar May 02 '18 14:05 tpeczek